2012-08-02 129 views
18

y_axisをどのように反転できますか? :@クリスはこれがで行うことができ、言ったように enter image description herematplotlib graficの軸を反転

+0

[this](http://old.nabble.com/How-to-reverse-the-direction-of-anaxis-td15170464.html)のCurtsey投稿では、 'ax.set_ylim (ax.get_ylim()[:: - 1]) 'または[' ax.invert_yaxis() '](http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.invert_yaxis)、 'ax'は' matplotlib.axes.Axes'オブジェクトです。 – Chris

+0

[Matplotlib coordの可能な複製。 sysの原点を左上に移動](http://stackoverflow.com/questions/1349230/matplotlib-coord-sys-origin-to-top-left) – Chris

答えて

38

:私はこれを必要

enter image description here

:Zは、私はこれを持っています

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() 

np.array.Thankです

ax = plt.gca() 
ax.invert_yaxis() 

前に 'plt。 show() '。

+7

また、 'ax'を他の用途に使用しない場合、ライナー 'plt.gca().invert_yaxis()'も動作します。 – heltonbiker