- matplotlib.pyplot.show(*, block=None)#
Display all open figures.
- blockbool, optional
Whether to wait for all figures to be closed before returning.
Trueblock and run the GUI main loop until all figure windows are closed.
Falseensure that all figure windows are displayed and return immediately. In this case, you are responsible for ensuring that the event loop is running to have responsive figures.
Defaults to True in non-interactive mode and to False in interactive mode (see
Saving figures to file and showing a window at the same time
If you want an image file as well as a user interface window, use
pyplot.show. At the end of (a blocking)
show()the figure is closed and thus unregistered from pyplot. Calling
pyplot.savefigafterwards would save a new and thus empty figure. This limitation of command order does not apply if the show is non-blocking or if you keep a reference to the figure and use
Auto-show in jupyter notebooks
The jupyter backends (activated via
%matplotlib notebook, or
%matplotlib widget), call
show()at the end of every cell by default. Thus, you usually don't have to call it explicitly there.