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" or None).

The method parameter allows to override the default display method for the current figure. The parameters dpi and width 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 preview

    • None: Reset to the default display method

    The default display method is "external" in Python consoles and "notebook" in Jupyter notebooks, but can be changed by pygmt.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 if method="external".

  • **kwargs (dict) – Additional keyword arguments passed to pygmt.Figure.psconvert. Valid parameters are gs_path, gs_option, resize, bb_style, and verbose.

Return type:

None

Examples using pygmt.Figure.show

Plotting a surface

Plotting a surface

3-D scatter plots

3-D scatter plots

Double Y-axes graph

Double Y-axes graph

Ternary diagram

Ternary diagram

Colorbar

Colorbar

Multiple colormaps

Multiple colormaps

Inset

Inset

Inset map showing a rectangular region

Inset map showing a rectangular region

Legend

Legend

Logo

Logo

Scale bar

Scale bar

Day-night terminator line and twilights

Day-night terminator line and twilights

Timestamp

Timestamp

Blockmean

Blockmean

Histogram

Histogram

Rose diagram

Rose diagram

Scatter plot with histograms

Scatter plot with histograms

Contours

Contours

Cross-section along a transect

Cross-section along a transect

Clipping grid values

Clipping grid values

Calculating grid gradient and radiance

Calculating grid gradient and radiance

Calculating grid gradient with custom azimuth and normalize parameters

Calculating grid gradient with custom azimuth and normalize parameters

Create ‘wet-dry’ mask grid

Create 'wet-dry' mask grid

Images on figures

Images on figures

RGB image

RGB image

Sampling along tracks

Sampling along tracks

Connection lines

Connection lines

Decorated lines

Decorated lines

Envelope

Envelope

Generate points along great circles

Generate points along great circles

Horizontal and vertical lines

Horizontal and vertical lines

Line colors with a custom CPT

Line colors with a custom CPT

Line segment caps and joints

Line segment caps and joints

Line fronts

Line fronts

GeoPandas: Plotting lines with LineString or MultiLineString geometry

GeoPandas: Plotting lines with LineString or MultiLineString geometry

Line styles

Line styles

Quoted lines

Quoted lines

Vector heads and tails

Vector heads and tails

Cartesian, circular, and geographic vectors

Cartesian, circular, and geographic vectors

Wiggle along tracks

Wiggle along tracks

Political boundaries

Political boundaries

Choropleth map

Choropleth map

Highlight country, continent and state polygons

Highlight country, continent and state polygons

Color land and water

Color land and water

Shorelines

Shorelines

Tile maps

Tile maps

Focal mechanisms

Focal mechanisms

Velocity arrows and confidence ellipses

Velocity arrows and confidence ellipses

Vertical or horizontal bars

Vertical or horizontal bars

Basic geometric symbols

Basic geometric symbols

Custom symbols

Custom symbols

Datetime inputs

Datetime inputs

Multi-parameter symbols

Multi-parameter symbols

Bit and hachure patterns

Bit and hachure patterns

Points

Points

Color points by categories

Color points by categories

Points with varying transparency

Points with varying transparency

Scatter plots with a legend

Scatter plots with a legend

Text symbols

Text symbols

1. Making your first figure

1. Making your first figure

2. Create a contour map

2. Create a contour map

3. Figure elements

3. Figure elements

4. PyGMT I/O: Table inputs

4. PyGMT I/O: Table inputs

Azimuthal equidistant projection

Azimuthal equidistant projection

Perspective projection

Perspective projection

General stereographic projection

General stereographic projection

Gnomonic projection

Gnomonic projection

Lambert azimuthal equal-area projection

Lambert azimuthal equal-area projection

Orthographic projection

Orthographic projection

Albers conic equal-area projection

Albers conic equal-area projection

Equidistant conic projection

Equidistant conic projection

Lambert conic conformal projection

Lambert conic conformal projection

Polyconic projection

Polyconic projection

Cassini cylindrical projection

Cassini cylindrical projection

Cylindrical equal-area projection

Cylindrical equal-area projection

Cylindrical equidistant projection

Cylindrical equidistant projection

Mercator projection

Mercator projection

Miller cylindrical projection

Miller cylindrical projection

Oblique Mercator projection

Oblique Mercator projection

Cylindrical stereographic projection

Cylindrical stereographic projection

Transverse Mercator projection

Transverse Mercator projection

Universal Transverse Mercator projection

Universal Transverse Mercator projection

Eckert IV equal-area projection

Eckert IV equal-area projection

Eckert VI equal-area projection

Eckert VI equal-area projection

Hammer projection

Hammer projection

Mollweide projection

Mollweide projection

Robinson projection

Robinson projection

Sinusoidal projection

Sinusoidal projection

Van der Grinten projection

Van der Grinten projection

Winkel Tripel projection

Winkel Tripel projection

Cartesian linear

Cartesian linear

Cartesian logarithmic

Cartesian logarithmic

Cartesian power

Cartesian power

Polar

Polar

Creating a 3-D perspective image

Creating a 3-D perspective image

Cartesian histograms

Cartesian histograms

Configuring PyGMT defaults

Configuring PyGMT defaults

Creating a map with contour lines

Creating a map with contour lines

Plotting datetime charts

Plotting datetime charts

Draping a dataset on top of a topographic surface

Draping a dataset on top of a topographic surface

Plotting Earth relief

Plotting Earth relief

Performing grid histogram equalization

Performing grid histogram equalization

Adding an inset to the figure

Adding an inset to the figure

Creating legends

Creating legends

Typesetting non-ASCII text

Typesetting non-ASCII text

Making subplots

Making subplots

Plotting vectors

Plotting vectors

Interactive data visualization using Panel

Interactive data visualization using Panel

Coastlines and borders

Coastlines and borders

Frames, ticks, titles, and labels

Frames, ticks, titles, and labels

Plotting lines

Plotting lines

Plotting data points

Plotting data points

Plotting polygons

Plotting polygons

Setting the region

Setting the region

Plotting text

Plotting text