看下面的例子:
import matplotlib.pyplot as pltfig, axes = plt.subplots(nrows=3, ncols=3)for ax in axes.flat: im = ax.imshow(np.random.random((6,6)), interpolation='nearest', cmap='gnuplot', vmin=0, vmax=1, extent=[0.05,0.5,1,0.05],aspect=0.5)fig.subplots_adjust(right=0.8)# put colorbar at desire positioncbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])fig.colorbar(im, cax=cbar_ax)plt.show()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)