1
你好,我不知道什么是不对的this.I有这个mgrib结合z值Matplotlib imshow()出错
pp=array(Arrays) #This is my Array that extract a Grid
y,x=np.mgrid[slice(0,25, 1),slice(0,42, 1)]
z=pp[y,x,1] #Extract Z with x,y position in the Array of pp
当执行:
cmap = plt.get_cmap('Azul-Rojo-Alpha')
norm = matplotlib.colors.Normalize(vmax=pp[:,:,1].max(), vmin=pp[:,:,1].min())
plt.imshow(z, cmap=cmap, norm=norm, interpolation='nearest')
给我这个错误:
ValueError: data mapping points must start with x=0. and end with x=1
如果检查并且错误在这里:
cdict1 = {
'red': ((0.0, 0.0, (7.0/255.0)),
(1.0, 1.0, 1.0)),
'green': ((0.0, 0.0, (183.0/255.0)),
(0.0, (44.0/255.0), 1)),
'blue': ((0.0, 0.0,1.0),
(1.0, 0.0, 1.0))
}
cdict1['alpha'] = ((0.0, 1.0, 1.0),
(0.5, 0.0, 0.0),
(1.0, 1.0, 1.0))
TEMPE = LinearSegmentedColormap('Azul-Rojo-Alpha', cdict1)
plt.register_cmap(cmap=TEMPE)
但我不知道为什么。
对不起我的英语
好像你的正常化,不是出于某种原因正常工作..但我不能说更多。 – cgeroux
对不起,我收录了更多信息 – virtualsets