def add_colorbar(idx, cm, height, width, colorbar_bins=8, fontsize=None, img_width=1, scale=0.9):
axis = plt.subplot(idx)
plt.imshow(np.ones((height*scale, img_width)), alpha=0)
# colorbar width must be given as a percentage of the img width,
# both together should be equal to w/wscale
width_factor = 100 * (width - img_width) / float(img_width)
divider = make_axes_locatable(axis)
cax = divider.append_axes("right", size=str(width_factor)+"%", pad=0.0)
create_colorbar(cm, cax, colorbar_bins, fontsize)
plotting.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录