pygmt.set_display
- pygmt.set_display(method=None)[source]
Set the display method when calling
pygmt.Figure.show
.- Parameters:
method (
Literal
['external'
,'notebook'
,'none'
,None
], default:None
) –The method to display an image preview. Choose from:
"external"
: External PDF preview using the default PDF viewer"notebook"
: Inline PNG preview in the current notebook"none"
: Disable image previewNone
: Reset to the default display method, which is either"external"
in Python consoles or"notebook"
in Jupyter notebooks.
Examples
Let’s assume that you’re using a Jupyter Notebook:
>>> import pygmt >>> fig = pygmt.Figure() >>> fig.basemap(region=[0, 10, 0, 10], projection="X10c/5c", frame=True) >>> fig.show() # Will display a PNG image in the current notebook >>> >>> # Set the display method to "external" >>> pygmt.set_display(method="external") >>> fig.show() # Will display a PDF image using the default PDF viewer >>> >>> # Set the display method to "none" >>> pygmt.set_display(method="none") >>> fig.show() # Will not show any image >>> >>> # Reset to the default display method >>> pygmt.set_display(method=None) >>> fig.show() # Again, will show a PNG image in the current notebook