I am using pyplot with matplotlib and I would like to display some data as an image. When I use imshow() , the data is upside down from the way I want to view it. How would I switch the x and y axes, either using imshow() or into a numpy array before sending it to imshow() ?
pyplot
matplotlib
imshow()
numpy
(i.e. I want the horizontal axis to be vertical)
I tried using origin='upper' and origin='lower' in the imshow() command, but that just changes one axis instead of switching it
origin='upper'
origin='lower'
I also tried using reshape for the data, but the order reshape
reshape
To close the question -
You need to transfer the numpy array before passing it to matplotlib :
>>> a array([[0, 1], [2, 3]]) >>> a=aT >>> a array([[0, 2], [1, 3]])
Thus, using plt , this should be simple:
plt
plt.imshow(aT)