import matplotlib.pyplot as plt
my_x_ticks = np.arange(0, 370, 60)
x, y = np.mgrid[1:360:360j, 1:87:87j]#
plt.clf()
plt.subplots_adjust(hspace=1.2)#subplot上下图间距调节;左右间距调节:wspace
plt.subplot(311)
h=plt.pcolor(x, y, ytest, shading='auto',cmap = 'jet')
cb=plt.colorbar(h,aspect=5)#colorbar宽度调节,数值越小宽度越大
cb.ax.set_title('m/s') #colorbar title:在colorbar上方添加文本;cb.set_label:在colorbar右侧添加文本
plt.ylim([87,1])
plt.title('xxxx')
plt.xlabel('xx(min)')
plt.ylabel('xxx(m)')
plt.xticks(my_x_ticks,('0','10','20','30','40','50','60'))
plt.savefig('./111.png')
plt.show()
Python matplotlib常用画图代码备份
最新推荐文章于 2024-08-15 01:55:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)