matplotlib.pyplot.show#
- matplotlib.pyplot.show(*,block=None)[source]#
Display all open figures.
- Parameters:
- blockbool, optional
Whether to wait for all figures to be closed before returning.
If
Trueblock and run the GUI main loop until all figure windowsare closed.If
Falseensure that all figure windows are displayed and returnimmediately. In this case, you are responsible for ensuringthat the event loop is running to have responsive figures.Defaults to True in non-interactive mode and to False in interactivemode (see
pyplot.isinteractive).
See also
Notes
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.savefigbeforepyplot.show. At the end of (a blocking)show()the figure is closed and thus unregistered from pyplot. Callingpyplot.savefigafterwards would save a new and thus empty figure. Thislimitation of command order does not apply if the show is non-blocking orif you keep a reference to the figure and useFigure.savefig.Auto-show in jupyter notebooks
The jupyter backends (activated via
%matplotlibinline,%matplotlibnotebook, or%matplotlibwidget), callshow()atthe end of every cell by default. Thus, you usually don't have to call itexplicitly there.
Examples usingmatplotlib.pyplot.show#
Control the position and size of a colorbar with Inset Axes
Align histogram to scatter plot using locatable Axes
Shade regions defined by a logical mask using fill_between
Building histograms using Rectangles and PolyCollections
Plot contour (level) curves in 3D using the extend3d option
3D voxel / volumetric plot with cylindrical coordinates
Line, Poly and RegularPoly Collection with autoscaling
SkewT-logP diagram: using transforms and custom projections
Plot a confidence ellipse of a two-dimensional dataset
Create boxes from error bars using PatchCollection
Demo of the histogram function's different histtype settings
The histogram (hist) function with multiple data sets
Controlling view limits using margins and sticky_edges
Concatenate text objects with different properties
Controlling style of text and labels using a dictionary
SI prefixed offsets and natural order of magnitudes
Select indices from a collection using polygon selector
Customizing Matplotlib with style sheets and rcParams