I wrote a simple code to form taylor digram using skillmetrics package. I used python version Python 2.7.12. The code is as follows:-
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import skill_metrics as sm
fire=pd.read_csv('fire.csv')
PMfire = zip(fire['Date'],fire['PM_fire'],fire['Embassy_PM'])
#taylor_stats1 = sm.taylor_statistics('PM_fire','Embassy_PM','Date')
o= {"Data":fire['Embassy_PM'],'Date':fire['Date']}# form date and and embassy datas
p= {"Data":fire['PM_fire'],'Date':fire['Date']}# form dictionary containg pm_fire and date
# Calculate statistics for Taylor diagram
# The first array element corresponds to the reference series
# for the while the second is that for the predicted series.
taylor_stats1 = sm.taylor_statistics(p,o,'Data')
sdev = np.array([taylor_stats1['sdev'][0]])# Calculate standard deviation
crmsd = np.array([taylor_stats1['crmsd'][0]])#Calculate root mean square difference
ccoef = np.array([taylor_stats1['ccoef'][0]])# Calculate correlation coefficient
sm.taylor_diagram(sdev,crmsd,ccoef)#form taylor digram
plt.savefig('taylor.png')
plt.show()
But, it is giving me error.The error is as follows:-
File "<ipython-input-2-edf3b67792d8>", line 1, in <module>
runfile('/home/mala/Downloads/F/taylor_plot.py', wdir='/home/mala/Downloads/F')
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)
File "/home/mala/Downloads/F/taylor_plot.py", line 21, in <module>
sm.taylor_diagram(sdev,crmsd,ccoef)
File "/usr/local/lib/python2.7/dist-packages/skill_metrics/taylor_diagram.py", line 110, in taylor_diagram
plot_pattern_diagram_markers(X,Y,option)
File "/usr/local/lib/python2.7/dist-packages/skill_metrics/plot_pattern_diagram_markers.py", line 104, in plot_pattern_diagram_markers
rgba = clr.to_rgb(option['markercolor']) + (alpha,)
AttributeError: 'module' object has no attribute 'to_rgb'
The to_rgb
function was added relatively recently to the matplotlib.colors
namespace. You probably have an older version of matplotlib installed. Try updating to the latest version of matplotlib.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With