反转Matplotlib grafic中的轴 [英] Invert an axis in a matplotlib grafic
本文介绍了反转Matplotlib grafic中的轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何反转y_axis? Z是一个np.array.谢谢
How can I invert the y_axis? Z is a np.array.Thank you
Z=TempLake
X,Y=np.meshgrid(range(Z.shape[0]+1),range(Z.shape[1]+1))
im = plt.pcolormesh(X,Y,Z.transpose(), cmap='hot')
plt.colorbar(im, orientation='horizontal')
plt.show()
我有这个:
我需要这个:
推荐答案
正如@Chris所说,可以通过以下方式完成:
As @Chris said, this can be done with:
ax = plt.gca()
ax.invert_yaxis()
在"plt.show()"之前.
Before the 'plt.show()'.
这篇关于反转Matplotlib grafic中的轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文