pygmt.Figure.show
- Figure.show(method=None, dpi=300, width=500, waiting=0.5, **kwargs)[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).
Use
pygmt.set_display
to select the default display method ("notebook"
,"external"
,"none"
orNone
).The
method
parameter allows to override the default display method for the current figure. The parametersdpi
andwidth
can be used to control the resolution and dimension of the figure in the notebook.The external viewer can be disabled by setting the environment variable PYGMT_USE_EXTERNAL_DISPLAY to
"false"
. This is useful when running tests and building the documentation to avoid popping up windows.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 the image viewer on your computer is slow to open the figure.- Parameters:
method (
Literal
['external'
,'notebook'
,'none'
,None
], default:None
) –The method to display the current 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
The default display method is
"external"
in Python consoles and"notebook"
in Jupyter notebooks, but can be changed bypygmt.set_display
.dpi (
int
, default:300
) – The image resolution (dots per inch) in Jupyter notebooks.width (
int
, default:500
) – The image width (in pixels) in Jupyter notebooks.waiting (
float
, default:0.5
) – Suspend the execution of the current process for a given number of seconds after launching an external viewer. Only works ifmethod="external"
.**kwargs (dict) – Additional keyword arguments passed to
pygmt.Figure.psconvert
. Valid parameters aregs_path
,gs_option
,resize
,bb_style
, andverbose
.
Examples using pygmt.Figure.show
Frames, ticks, titles, and labels
Creating a 3-D perspective image
Creating a map with contour lines
Draping a dataset on top of a topographic surface
Interactive data visualization using Panel
Performing grid histogram equalization
Highlight country, continent and state polygons
Cartesian, circular, and geographic vectors
Generate points along great circles
Points with varying transparency
Calculating grid gradient and radiance
Calculating grid gradient with custom azimuth and normalize parameters
Cross-section along a transect
Velocity arrows and confidence ellipses
Day-night terminator line and twilights
Inset map showing a rectangular region
Azimuthal equidistant projection
General stereographic projection
Lambert azimuthal equal-area projection
Albers conic equal-area projection
Lambert conic conformal projection
Cassini cylindrical projection
Cylindrical equal-area projection
Cylindrical equidistant projection
Cylindrical stereographic projection
Transverse Mercator projection
Universal Transverse Mercator projection
Eckert IV equal-area projection
Eckert VI equal-area projection