I wanted the imshow() function in matplotlib.pyplot to display images the opposite way, i.e upside down. Is there a simple way to do this?

Specify the keyword argument origin='lower' or origin='upper' in your call to imshow.

You can use the extent argument. For example, if X values range from -10 and 10 and Y values range from -5 to 5, you should pass extent=(-10,10,-5,5) to imshow().

Use ax.invert_yaxis() to invert the y-axis, or ax.invert_xaxis() to invert the x-axis.

add .T after the data you want to plot

plt.imshow(data.T)

This will “transpose” the data