pygmt.Figure.show

Figure.show(dpi=300, width=500, method=None, 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).

pygmt.set_display can select the default display method ("notebook", "external", "none" 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, 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 or None) –

    How the current figure will be displayed. 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 or "notebook" in Jupyter notebooks, but can be changed by pygmt.set_display.

  • 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".

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

Examples using pygmt.Figure.show

Color land and water

Color land and water

Highlight country, continent and state polygons

Highlight country, continent and state polygons

Political Boundaries

Political Boundaries

Shorelines

Shorelines

Tile maps

Tile maps

Cartesian, circular, and geographic vectors

Cartesian, circular, and geographic vectors

Decorated lines

Decorated lines

Envelope

Envelope

Generate points along great circles

Generate points along great circles

Line colors with a custom CPT

Line colors with a custom CPT

Line fronts

Line fronts

Line styles

Line styles

Quoted lines

Quoted lines

Roads

Roads

Vector heads and tails

Vector heads and tails

Wiggle along tracks

Wiggle along tracks

Basic geometric symbols

Basic geometric symbols

Bit and Hachure Patterns

Bit and Hachure Patterns

Color points by categories

Color points by categories

Custom symbols

Custom symbols

Datetime inputs

Datetime inputs

Multi-parameter symbols

Multi-parameter symbols

Points

Points

Points with varying transparency

Points with varying transparency

Scatter plots with a legend

Scatter plots with a legend

Text symbols

Text symbols

Vertical or horizontal bars

Vertical or horizontal bars

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

Clipping grid values

Clipping grid values

Contours

Contours

Create ‘wet-dry’ mask grid

Create 'wet-dry' mask grid

Cross-section along a transect

Cross-section along a transect

Images on figures

Images on figures

RGB Image

RGB Image

Sampling along tracks

Sampling along tracks

3-D Scatter plots

3-D Scatter plots

Plotting a surface

Plotting a surface

Focal mechanisms

Focal mechanisms

Velocity arrows and confidence ellipses

Velocity arrows and confidence ellipses

Double Y axes graph

Double Y axes graph

Ternary diagram

Ternary diagram

Blockmean

Blockmean

Histogram

Histogram

Rose diagram

Rose diagram

Scatter plot with histograms

Scatter plot with histograms

Colorbar

Colorbar

Day-night terminator line and twilights

Day-night terminator line and twilights

Inset

Inset

Inset map showing a rectangular region

Inset map showing a rectangular region

Legend

Legend

Logo

Logo

Multiple colormaps

Multiple colormaps

Timestamp

Timestamp

Coastlines and borders

Coastlines and borders

Frames, ticks, titles, and labels

Frames, ticks, titles, and labels

Plotting data points

Plotting data points

Plotting lines

Plotting lines

Plotting text

Plotting text

Setting the region

Setting the region

Adding an inset to the figure

Adding an inset to the figure

Cartesian histograms

Cartesian histograms

Configuring PyGMT defaults

Configuring PyGMT defaults

Creating a 3-D perspective image

Creating a 3-D perspective image

Creating a map with contour lines

Creating a map with contour lines

Interactive data visualization using Panel

Interactive data visualization using Panel

Making subplots

Making subplots

Performing grid histogram equalization

Performing grid histogram equalization

Plotting Earth relief

Plotting Earth relief

Plotting datetime charts

Plotting datetime charts

Plotting vectors

Plotting vectors

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

Azimuthal Equidistant

Azimuthal Equidistant

General Perspective

General Perspective

General Stereographic

General Stereographic

Gnomonic

Gnomonic

Lambert Azimuthal Equal Area

Lambert Azimuthal Equal Area

Orthographic

Orthographic

Albers Conic Equal Area

Albers Conic Equal Area

Equidistant conic

Equidistant conic

Lambert Conic Conformal Projection

Lambert Conic Conformal Projection

Polyconic Projection

Polyconic Projection

Cassini Cylindrical

Cassini Cylindrical

Cylindrical Stereographic

Cylindrical Stereographic

Cylindrical equal-area

Cylindrical equal-area

Cylindrical equidistant

Cylindrical equidistant

Mercator

Mercator

Miller cylindrical

Miller cylindrical

Oblique Mercator, 1: origin and azimuth

Oblique Mercator, 1: origin and azimuth

Oblique Mercator, 2: two points

Oblique Mercator, 2: two points

Oblique Mercator, 3: origin and pole

Oblique Mercator, 3: origin and pole

Transverse Mercator

Transverse Mercator

Universal Transverse Mercator

Universal Transverse Mercator

Eckert IV

Eckert IV

Eckert VI

Eckert VI

Hammer

Hammer

Mollweide

Mollweide

Robinson

Robinson

Sinusoidal

Sinusoidal

Van der Grinten

Van der Grinten

Winkel Tripel

Winkel Tripel

Cartesian linear

Cartesian linear

Cartesian logarithmic

Cartesian logarithmic

Cartesian power

Cartesian power

Polar

Polar