2012-08-02 10 views
18

मैं y_axis को कैसे उलटा सकता हूं? जेड एक np.array.Thank आपएक matplotlib grafic में एक अक्ष को घुमाएं

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

मैं इस है:

enter image description here

मैं इस की जरूरत है: enter image description here

+0

[इस] के कर्टसी (http://old.nabble.com/How-to-reverse-the-direction-of-an-axis--td15170464.html) पोस्ट, आप या तो '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 समन्वय के संभावित डुप्लिकेट। sys मूल शीर्ष बाईं ओर] (http://stackoverflow.com/questions/1349230/matplotlib-coord-sys-origin-to-top-left) – Chris

उत्तर

38

रूप @Chris ने कहा, इस के साथ किया जा सकता है:

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

'plt से पहले। प्रदर्शन()'।

+7

भी, यदि कोई अन्य उपयोग 'ax' के लिए नहीं है, तो एक- लाइनर 'plt.gca()। invert_yaxis() 'भी काम करता है। – heltonbiker

संबंधित मुद्दे