matplotlib.figure.Figure.show#
- Figure.show(warn=True)[source]#
If using a GUI backend with pyplot, display the figure window.
If the figure was not created using
figure, it will lackaFigureManagerBase, and this method will raise anAttributeError.Warning
This does not manage an GUI event loop. Consequently, the figuremay only be shown briefly or not shown at all if you or yourenvironment are not managing an event loop.
Use cases for
Figure.showinclude running this from a GUIapplication (where there is persistently an event loop running) orfrom a shell, like IPython, that install an input hook to allow theinteractive shell to accept input while the figure is also beingshown and interactive. Some, but not all, GUI toolkits willregister an input hook on import. SeeCommand prompt integration formore details.If you're in a shell without input hook integration or executing apython script, you should use
matplotlib.pyplot.showwithblock=Trueinstead, which takes care of starting and runningthe event loop for you.- Parameters:
- warnbool, default: True
If
Trueand we are not running headless (i.e. on Linux with anunset DISPLAY), issue warning when called on a non-GUI backend.