我有一个使用对数比例的颜色条的数字,如下所示。我正在使用cmap='RdBu_r'
,我希望值1为白色,而颜色条上的白色接近2.8。谁能告诉我如何调整这个?
代码:
from mpl_toolkits.basemap import Basemap
m = Basemap(projection='robin', lon_0=180)
fig = plt.figure(figsize=(17,4))
axi1 = fig.add_subplot(121)
m.fillcontinents(color='0.5', lake_color='0.7')
m.drawmapboundary(fill_color='none')
x, y = m(np.ma.masked_invalid(np.roll(lon, -110, axis=1)[:210, :352]),
np.ma.masked_invalid(np.roll(lat, -110, axis=1)[:210, :352]))
pc = m.pcolor(x, y,
np.ma.masked_invalid(np.roll(1.6**-1 * RdML_win * 2*np.pi / drT,
-110, axis=1)[:210, :352]), cmap='RdBu_r',
norm=colors.LogNorm(vmin=.5, vmax=1e1))
axi1.set_title(r'winter', fontsize=16, y=1.06)
m.drawparallels(range(-60,61,30), labels=[1,1,0,0]);
m.drawmeridians(range(30,360,60), labels=[0,0,1,1]);
axi2 = fig.add_subplot(122)
m.fillcontinents(color='0.5', lake_color='0.7')
m.drawmapboundary(fill_color='none')
x, y = m(np.ma.masked_invalid(np.roll(lon, -110, axis=1)[:210, :352]),
np.ma.masked_invalid(np.roll(lat, -110, axis=1)[:210, :352]))
pc = m.pcolor(x, y,
np.ma.masked_invalid(np.roll(1.6**-1 * RdML_sum * 2*np.pi / drT,
-110, axis=1)[:210, :352]), cmap='RdBu_r',
norm=colors.LogNorm(vmin=.5, vmax=1e1))
axi2.set_title(r'summer', fontsize=16, y=1.06)
m.drawparallels(range(-60,61,30), labels=[1,1,0,0]);
m.drawmeridians(range(30,360,60), labels=[0,0,1,1]);
cbar_axim = fig.add_axes([0.93, 0.14, 0.02, 0.7])
cbar = fig.colorbar(pc, cax=cbar_axim, ticks=[.5, 1., 3., 6., 1e1])
cbar.set_ticklabels(['0.5', '1.', '3.', '6.', '10.'])
cbar.set_label(r'$\frac{1.6^{-1} L_d^{ML}}{\Delta x}$', fontsize=17)