Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invert image displayed by imshow in matplotlib

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?

like image 919
pratikm Avatar asked Dec 06 '11 06:12

pratikm


People also ask

How do I flip an image in matplotlib?

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

Does Imshow normalize image?

By default, imshow normalizes the data to its min and max. You can control this with either the vmin and vmax arguments or with the norm argument (if you want a non-linear scaling).

What is the difference between PLT Imshow and PLT show?

show() displays the figure (and enters the main loop of whatever gui backend you're using). You shouldn't call it until you've plotted things and want to see them displayed. plt. imshow() draws an image on the current figure (creating a figure if there isn't a current figure).

What is CMAP in PLT Imshow?

cmap : This parameter is a colormap instance or registered colormap name. norm : This parameter is the Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colors. vmin, vmax : These parameter are optional in nature and they are colorbar range.


1 Answers

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

like image 150
wim Avatar answered Sep 17 '22 02:09

wim