Matplotlib coord. sys origin to top left
The easiest way is to use:
plt.gca().invert_yaxis()
After you plotted the image. Origin
works only for imshow
.
axis ij
just makes the y-axis increase downward instead of upward, right? If so, then matplotlib.axes.invert_yaxis()
might be all you need -- but I can't test that right now.
If that doesn't work, I found a mailing post suggesting that
setp(gca(), 'ylim', reversed(getp(gca(), 'ylim')))
might do what you want to resemble axis ij
.
For an image or contour plot, you can use the keyword origin = None | 'lower' | 'upper'
and for a line plot, you can set the ylimits high to low.
from pylab import *A = arange(25)/25.A = A.reshape((5,5))figure()imshow(A, interpolation='nearest', origin='lower')figure()imshow(A, interpolation='nearest')d = arange(5)figure()plot(d)ylim(5, 0)show()