gplately.CartopyPlotEngine

class gplately.CartopyPlotEngine[source]

Bases: PlotEngine

Use Cartopy for map plotting.

__init__()[source]

Methods

__init__()

plot_geo_data_frame(ax_or_fig, gdf, **kwargs)

Use Cartopy to plot geometries in a GeoDataFrame object onto a map

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

Plot a grid onto a map using Cartopy

plot_pygplates_features(ax_or_fig, features, ...)

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

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

Use Cartopy to plot subduction zones with "teeth" onto a map

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

Use Cartopy to plot geometries in a GeoDataFrame object onto a map

Parameters:
  • ax_or_fig (cartopy.mpl.geoaxes.GeoAxes) – Cartopy GeoAxes instance

  • gdf (GeoDataFrame) – GeoPandas GeoDataFrame object

plot_grid(ax_or_fig, grid, projection=None, extent=(-180, 180, -90, 90), shading=None, **kwargs)[source]

Plot a grid onto a map using Cartopy

Parameters:
  • ax_or_fig (cartopy.mpl.geoaxes.GeoAxes) – Cartopy GeoAxes instance

  • grid (2D array-like) – The grid data to be plotted

  • projection (cartopy.crs.Projection) – The projection to use for the grid

  • extent (tuple) – The extent of the grid in the form (min_lon, max_lon, min_lat, max_lat)

  • shading (bool, xarray.DataArray, array-like, or dict, optional) –

    Apply illumination/hillshading to the plotted grid.

    • None or False (default): no shading is applied.

    • True: derive hillshade from grid using default parameters.

    • xarray.DataArray or array-like: use this as the intensity grid for shading (for example, a topography raster).

    • dict: configure shading with keys:

      • intensity: optional intensity grid (DataArray or array-like).

      • scale: hillshade scale (default 10.0).

      • azdeg: light azimuth in degrees (default 165.0).

      • altdeg: light altitude in degrees (default 45.0).

      • cmap: colormap used to colorize grid before shading.

      • vmin/vmax: normalization bounds for the base colormap.

    Any unknown keys in the dict raise a ValueError.

  • **kwargs – Keyword arguments for plotting the grid which are the same as Matplotlib’s imshow() keyword arguments.

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

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

Point-like geometries are rendered with scatter so marker styling behaves as expected, while line/polygon geometries are rendered with add_geometries.

Parameters:
  • ax_or_fig (cartopy.mpl.geoaxes.GeoAxes) – Cartopy GeoAxes instance

  • features (pygplates.Feature or list of pygplates.Feature) – One or more pygplates features to plot

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

  • crs (cartopy.crs.Projection) – The coordinate reference system of the input geometries. Default is PlateCarree (lon/lat).

  • **kwargs – Keyword arguments for plotting the features. see Matplotlib’s plot() and scatter() keyword arguments for line/polygon and point geometries, respectively.

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 Cartopy to plot subduction zones with “teeth” onto a map

Parameters:
  • ax_or_fig (cartopy.mpl.geoaxes.GeoAxes) – Cartopy GeoAxes instance

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