gplately.CartopyPlotEngine
- class gplately.CartopyPlotEngine[source]
Bases:
PlotEngineUse Cartopy for map plotting.
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.
NoneorFalse(default): no shading is applied.True: derive hillshade fromgridusing default parameters.xarray.DataArrayor 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 (default10.0).azdeg: light azimuth in degrees (default165.0).altdeg: light altitude in degrees (default45.0).cmap: colormap used to colorizegridbefore 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
scatterso marker styling behaves as expected, while line/polygon geometries are rendered withadd_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()andscatter()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
ValidTimeFilterfor 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”.