pygmt.Figure.show
- Figure.show(dpi=300, width=500, method=None, waiting=0.5)[source]
Display a preview of the figure.
Inserts the preview in the Jupyter notebook output if available, otherwise opens it in the default viewer for your operating system (falls back to the default web browser).
pygmt.set_display
can select the default display method (notebook, external, or none).The
method
parameter can also override the default display method for the current figure. Parametersdpi
andwidth
can be used to control the resolution and dimension of the figure in the notebook.Note: The external viewer can be disabled by setting the PYGMT_USE_EXTERNAL_DISPLAY environment variable to false. This is useful when running unit tests and building the documentation in consoles without a Graphical User Interface.
Note that the external viewer does not block the current process, thus it’s necessary to suspend the execution of the current process for a short while after launching the external viewer, so that the preview image won’t be deleted before the external viewer tries to open it. Set the
waiting
parameter to a larger number if your computer is slow.- Parameters
dpi (int) – The image resolution (dots per inch) in Jupyter notebooks.
width (int) – The image width (in pixels) in Jupyter notebooks.
method (str) –
How the current figure will be displayed. Options are
external: PDF preview in an external program [default]
notebook: PNG preview [default in Jupyter notebooks]
none: Disable image preview
waiting (float) – Suspend the execution of the current process for a given number of seconds after launching an external viewer. Only works if
method="external"
.