我想在一块地里放两块色条,配一张地图。不幸的是,色条和情节本身一样大。即使在色条代码中使用收缩,它也只会收缩色条,而不会收缩它们所占的大小。在
有没有一种简单的方法可以让我的图占用更多的空间,而让色条占用更少的空间?有没有一种简单的方法让色条在底部并排出现?在
代码在下面
plt.clf()
my_cmap = cm.get_cmap('YlOrRd')
cs = map.contourf(x,y,bj,levels = Y,cmap=my_cmap,locator=mpl.ticker.LogLocator())
norm = mpl.colors.BoundaryNorm(bounds, my_cmap.N)
cb1 = plt.colorbar(cmap=my_cmap,
norm=norm,
boundaries=bounds,
extend='both',
orientation="horizontal",
ticks=bounds,
shrink = 0.35)
cb1.set_label('Increase in Black Carbon')
bj = -bj
ymap = cm.get_cmap('PuBu')
cs = map.contourf(x,y,bj,levels = Y,cmap=ymap,locator=mpl.ticker.LogLocator())
# set colourbar with location and size, with labels.
norm = mpl.colors.BoundaryNorm(bounds,ymap.N)
cb2 = plt.colorbar(cmap=my_cmap,
norm=norm,
boundaries=bounds,
extend='both',
orientation="horizontal",
ticks=bounds,
shrink=0.35)
cb2.set_label('Decrease in Black Carbon')
font = {'family' : 'serif',
'color' : 'black',
'weight' : 'bold',
'size' : 21,
}
#add plot details
plt.title(r'Black Carbon surface concentrations changes in %s 2006 compared with %s 2006 ($\mu$gm$\^3$)'%(g,d) ,fontdict=font)
map.drawcoastlines(linewidth=0.75)
map.drawcountries(linewidth=0.25)
#show plot
plt.show()
您的问题的一个最小工作示例*和一些实现您所需的more options for ^{} :
相关问题 更多 >
编程相关推荐