低范围内颜色相同

时间:2018-01-16 06:44:52

标签: python matplotlib

# create figure and axes instances
fig = plt.figure(figsize=(8,8))
ax = fig.add_axes([0.1,0.1,0.8,0.8])

# create polar stereographic Basemap instance.

m = Basemap(projection='merc',lon_0=180,lat_0=0.,
        llcrnrlat=latcorners[-1,-1],urcrnrlat=latcorners[0,0],
        llcrnrlon=loncorners[0,0],urcrnrlon=loncorners[-1,-1],
        rsphere=6371200.,resolution='i',area_thresh=10000)


ny = cal_poc.shape[0]; nx = cal_poc.shape[1]
lons, lats = m.makegrid(nx, ny) # get lat/lons of ny by nx evenly space grid.
x, y = m(lons, lats) # compute map proj coordinates.

# draw filled contours
clevs = []
clev = 2**arange(11)
clevs.extend([0])
clevs.extend(clev)

# define the colormap
norm = matplotlib.colors.Normalize(vmin = nanmin(cal_poc), vmax = nanmax(cal_poc))


cs = m.contourf(x,y,cal_poc,clevs,cmap='jet',extend='max',norm=norm)

# add colorbar
cbar = m.colorbar(cs,location='bottom',pad="5%",ticks=clevs) 

plt.show()

我想在范围log2中绘制图形 但0~32的颜色范围是相同的 我不知道如何解决它。

我尝试了规范化和间距,但没有工作

你能解释一下为什么会在我的代码中发生这种情况吗?

0 个答案:

没有答案
相关问题