, width=500, method=None)[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. Parameters dpi and width 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.

  • 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

Examples using