gplately.PygmtPlotEngine

class gplately.PygmtPlotEngine[source]

Bases: PlotEngine

Use PyGMT for map plotting.

__init__()[source]

Methods

__init__()

plot_geo_data_frame(ax_or_fig, gdf, **kwargs)

Use PyGMT to plot geometries in a GeoDataFrame object onto a map.

plot_grid(ax_or_fig, grid[, projection, ...])

Use PyGMT to plot a grid onto a map.

plot_pygplates_features(ax_or_fig, features, ...)

Use PyGMT to plot one or more pygplates features onto a map.

plot_subduction_zones(ax_or_fig, ...[, color])

Use PyGMT to plot subduction zones with "teeth"

plot_geo_data_frame(ax_or_fig, gdf: GeoDataFrame, **kwargs)[source]

Use PyGMT to plot geometries in a GeoDataFrame object onto a map.

Parameters:
  • ax_or_fig (pygmt.Figure()) – pygmt Figure object

  • gdf (GeoDataFrame) – GeoPandas GeoDataFrame object

  • edgecolor (str) – For polygons, it is the border colour. For polylines, it is the line colour. Currently, only colour names are tested and officially supported, for example, “red”, “blue”, etc.

  • facecolor (str) – The colour used to fill the polygon.

  • fill (str) – GMT “fill” parameter

  • pen (str) – GMT “pen” parameter

  • style (str) – GMT “style” parameter

  • gmtlabel (str) – GMT “label” parameter for lines and polygons

  • pointlabel (str) – Optional label applied only to point geometries.

plot_grid(ax_or_fig, grid, projection=None, extent=(-180, 180, -90, 90), cmap='gmt/geo', nan_transparent=False, shading=None, **kwargs)[source]

Use PyGMT to plot a grid onto a map.

Parameters:
  • ax_or_fig (pygmt.Figure()) – A PyGMT Figure object.

  • grid (Raster) – A gplately Raster object or 2D array-like grid data.

  • projection (str) – Not used currently.

  • extent (str or tuple) – (xmin, xmax, ymin, ymax). See details at https://www.pygmt.org/dev/tutorials/basics/regions.html

  • cmap (str) – A built-in GMT colormaps name or a CPT file path.

  • nan_transparent (bool) – If True, NaN values in the grid will be plotted as transparent.

  • shading (bool, str, or grid-like, optional) –

    Apply illumination/hillshading to the grid image. Accepted values are:

    • True: use default shading parameters (equivalent to GMT -I+d).

    • A string such as "+a315+ne0.6" to pass directly as the GMT -I option (azimuth and intensity specification).

    • An xarray.DataArray or file path pointing to an illumination grid computed externally (e.g. via pygmt.grdgradient()).

    • None (default): no shading is applied.

  • **kwargs – Additional keyword arguments.

plot_pygplates_features(ax_or_fig, features, **kwargs)[source]

Use PyGMT to plot one or more pygplates features onto a map.

Parameters:
  • ax_or_fig (pygmt.Figure()) – pygmt Figure object

  • features (pygplates.Feature or list of pygplates.Feature) – One or more pygplates.Feature objects to be plotted.

  • edgecolor (str) – For polygons, it is the border colour. For polylines, it is the line colour.

  • facecolor (str) – The colour used to fill the polygon.

  • fill (str) – GMT “fill” parameter

  • pen (str) – GMT “pen” parameter

Warning

This method will not check features’ valid time. It just simply plots all the geometries in the features. You need to filter features by valid time yourself before passing them to this method if you want to plot features at a specific time.

See also

Use the class ValidTimeFilter for filtering features by valid time.

plot_subduction_zones(ax_or_fig, gdf_subduction_left: GeoDataFrame, gdf_subduction_right: GeoDataFrame, color='blue', **kwargs)[source]

Use PyGMT to plot subduction zones with “teeth”

Parameters:
  • ax_or_fig (pygmt.Figure()) – pygmt Figure object

  • gdf_subduction_left (GeoDataFrame) – subduction zone with “left” polarity

  • gdf_subduction_right (GeoDataFrame) – subduction zone with “right” polarity

  • color (str) – The colour used to fill the “teeth”.

  • gmtlabel (str) – GMT “label” parameter