resilientplotterclass

rpclass

class resilientplotterclass.rpclass.rpclass(project_guidelines=None, cartopy=False)[source]

Bases: object

basemap(crs=None, ax=None, m=None, map_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot basemap using contextily.

Parameters:
  • crs (pyproj.CRS or rasterio.CRS or str, optional) – Coordinate reference system.

  • ax (matplotlib.axes.Axes or folium.Map, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • map_style (str, optional) – Map type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.basemaps.plot_basemap().

Returns:

Axis.

Return type:

matplotlib.axes.Axes or holoviews.element.tiles.Tiles

cartopy(ax=None, m=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot cartopy geometries using geopandas.

Parameters:
  • ax (matplotlib.axes.Axes or folium.Map, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.geometries.plot_geometries().

Returns:

Axis.

Return type:

matplotlib.axes.Axes

close(fig=None, m=None)[source]

Close figure.

Parameters:
  • fig (matplotlib.figure.Figure) – Figure to close.

  • m (folium.Map) – Map to close.

Returns:

None.

Return type:

None

contour(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using contour.

Parameters:
  • data (xarray.DataArray or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes or folium.Map, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.contour() or resilientplotterclass.data_xugrid.contour().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

contourf(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using contourf.

Parameters:
  • data (xarray.DataArray or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes,) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.contourf() or resilientplotterclass.data_xugrid.contourf().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

create_video(file_paths, file_path_video, fps=5, **kwargs)[source]

Create video from images.

Parameters:
  • file_paths (list[str]) – File paths to images.

  • file_path_video (str) – File path to video.

  • fps (int, optional) – Frames per second.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.video.create_video().

Returns:

None.

draw_map(**kwargs)[source]

Create interactive map for drawing geometries.

Parameters:

kwargs (dict, optional) – Keyword arguments for resilientplotterclass.interactive.Draw_Map().

Returns:

Draw map.

Return type:

ipyleaflet.Map

geometries(gdf, ax=None, m=None, geom_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot geometries using geopandas.

Parameters:
  • gdf (geopandas.GeoDataFrame) – geometries to plot.

  • ax (matplotlib.axes.Axes or folium.Map, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • geom_style (str, optional) – Geometry type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.geometries.plot_geometries().

Returns:

Axis.

Return type:

matplotlib.axes.Axes or geoviews.element.chart.Polygons

get_cartopy()[source]

Get cartopy geometries.

Returns:

Cartopy geometries.

Return type:

geopandas.GeoDataFrame

get_guidelines()[source]

Get guidelines.

Returns:

Guidelines.

Return type:

dict

grid(data, ax=None, m=None, geom_style='grid', extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot grid using xugrid.

Parameters:
  • data (xarray.DataArray or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • geom_style (str, optional) – Geometry type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.grid() or resilientplotterclass.data_xugrid.grid().

Returns:

Axis.

Return type:

matplotlib.axes.Axes

imshow(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using imshow.

Parameters:
  • data (xarray.DataArray or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.imshow() or resilientplotterclass.data_xugrid.imshow().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh or geoviews.element.chart.Image

map(**kwargs)[source]

Create interactive map.

Parameters:

kwargs (dict, optional) – Keyword arguments for folium.Map().

Returns:

Map.

Return type:

folium.Map

See also: folium.Map()

pcolormesh(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using pcolormesh.

Parameters:
  • data (xarray.DataArray or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.pcolormesh() or resilientplotterclass.data_xugrid.pcolormesh().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh or geoviews.element.chart.Image

plot_colormaps()[source]

Plot custom colormaps.

Returns:

None.

Return type:

None

quiver(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using quiver.

Parameters:
  • data (xarray.Dataset or xugrid.UgridDataArray or xugrid.UgridDataset, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.quiver() or resilientplotterclass.data_xugrid.quiver().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

reproject(data, crs, **kwargs)[source]

Reproject data.

Parameters:
Returns:

Reprojected data.

Return type:

xarray.DataArray or xarray.Dataset or xugrid.UgridDataArray or xugrid.UgridDataset or geopandas.GeoDataFrame

See also: rioxarray.reproject,

geopandas.GeoDataFrame.to_crs.

save(fig=None, m=None, file_path=None, **kwargs)[source]

Save figure.

Parameters:
  • fig (matplotlib.figure.Figure) – Figure to save.

  • m (folium.Map) – Map to save.

  • file_path (str) – File path to save the figure.

  • kwargs (dict, optional) – Keyword arguments for matplotlib.figure.Figure.savefig() or folium.Map.save().

Returns:

None.

Return type:

None

See also: matplotlib.figure.Figure.savefig()

scatter(data, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using scatter.

Parameters:
  • data (xarray.DataArray or xarray.Dataset or xugrid.UgridDataArray, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.scatter() or resilientplotterclass.data_xugrid.scatter().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

set_cartopy(features=None, bounds=None, crs=None, buffer=0.1)[source]

Set cartopy geometries.

Parameters:
  • features (list[str], optional) – List of features to get.

  • bounds (list[float], optional) – Bounds of the cartopy geometries ([xmin, ymin, xmax, ymax]).

  • crs (str, optional) – Coordinate reference system of the cartopy geometries.

  • buffer – Buffer ratio to apply to the bounds.

Returns:

None.

Return type:

None

set_guidelines(project_guidelines=None)[source]

Set guidelines.

Parameters:

project_guidelines (str or dict, optional) – File path to the project guidelines file or dictionary with project guidelines.

Returns:

None.

Return type:

None

show(fig=None, m=None, draw=False, **kwargs)[source]

Show figure.

Parameters:
  • fig (matplotlib.figure.Figure) – Figure to show.

  • m (folium.Map or ipyleaflet.Map) – Map to show.

  • kwargs (dict, optional) – Keyword arguments for matplotlib.pyplot.show().

Returns:

None.

Return type:

None

See also: matplotlib.pyplot.show()

show_guideline_origins()[source]

Show guideline origins.

Returns:

None.

Return type:

None

show_guidelines(indent=20, open=True)[source]

Show guidelines.

Returns:

None.

Return type:

None

streamplot(da, ax=None, m=None, data_style=None, extent_style=None, interactive=None, show_kwargs=False, **kwargs)[source]

Plot data using streamplot.

Parameters:
  • da (xarray.Dataset, optional) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • m (folium.Map, optional) – Map.

  • data_style (str, optional) – Data type from guidelines.

  • extent_style (str, optional) – Extent type from guidelines.

  • interactive (bool, optional) – Interactive plot.

  • show_kwargs (bool, optional) – Show keyword arguments.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.data_xarray.streamplot().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

subplots(*args, **kwargs)[source]

Create figure and axes.

Parameters:
  • args (tuple, optional) – Positional arguments for matplotlib.pyplot.subplots().

  • kwargs (dict, optional) – Keyword arguments for matplotlib.pyplot.subplots().

Returns:

Figure and axes.

Return type:

tuple[matplotlib.figure.Figure, numpy.ndarray[matplotlib.axes.Axes]]

See also: matplotlib.pyplot.subplots()

to_structured(data, data_blueprint=None, bounds=None, resolution=None)[source]

Unstructured data to structured data.

Parameters:
  • data (xugrid.UgridDataArray or xugrid.UgridDataset) – Data to convert.

  • data_blueprint (xarray.DataArray or xarray.Dataset, optional) – Data blueprint.

  • bounds (tuple, optional) – Bounds of the rasterised data.

  • resolution (float, optional) – Resolution of the rasterised data.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.utils.rasterise_uda() or resilientplotterclass.utils.rasterise_uds().

Returns:

Structured data.

Return type:

xarray.DataArray or xarray.Dataset

to_unstructured(data, **kwargs)[source]

Structured data to unstructured data.

Parameters:
  • data (xarray.DataArray or xarray.Dataset) – Data to convert.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.utils.to_unstructured().

Returns:

Unstructured data.

Return type:

xugrid.UgridDataArray or xugrid.UgridDataset

structured_data

resilientplotterclass.structured_data.contour(da, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using contour.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.contour().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.contour.

resilientplotterclass.structured_data.contourf(da, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using contourf.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.contourf().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.contourf.

resilientplotterclass.structured_data.grid(da, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using grid.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.grid.

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes

resilientplotterclass.structured_data.imshow(da, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using imshow.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.imshow().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.imshow.

resilientplotterclass.structured_data.pcolormesh(da, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using pcolormesh.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.pcolormesh().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.pcolormesh.

resilientplotterclass.structured_data.quiver(ds, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using quiver.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.quiver().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.quiver.

resilientplotterclass.structured_data.scatter(ds, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using scatter.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.scatter().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.scatter.

resilientplotterclass.structured_data.streamplot(ds, ax=None, xy_unit=None, skip=1, smooth=1, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using streamplot.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xarray.plot.streamplot().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.streamplot.

unstructured_data

resilientplotterclass.unstructured_data.contour(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using contour.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.contour().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.plot.contour.

resilientplotterclass.unstructured_data.contourf(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using contourf.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.contourf().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.plot.contourf.

resilientplotterclass.unstructured_data.grid(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using grid.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.Ugrid2d.plot().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.Ugrid2d.plot.

resilientplotterclass.unstructured_data.imshow(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using imshow.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.imshow().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.plot.imshow.

resilientplotterclass.unstructured_data.pcolormesh(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using pcolormesh.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.pcolormesh().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.plot.pcolormesh.

resilientplotterclass.unstructured_data.quiver(uds, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using quiver.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.quiver().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xarray.plot.quiver.

resilientplotterclass.unstructured_data.scatter(uda, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot data using scatter.

Parameters:
  • uda (xugrid.UgridDataArray) – Data to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for xugrid.plot.scatter().

Returns:

Plot.

Return type:

matplotlib.collections.QuadMesh

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, xugrid.plot.scatter.

geometries

resilientplotterclass.geometries.get_gdf_cartopy(features=None, bounds=None, crs=None, buffer=0.1)[source]

Get a GeoDataFrame with cartopy geometries.

Parameters:
  • features (list[str], optional) – Cartopy features to include in the GeoDataFrame. If None, all cartopy features are included.

  • bounds (list[float], optional) – Bounds of the cartopy geometries ([xmin, ymin, xmax, ymax]).

  • crs (str, optional) – Coordinate reference system of the cartopy geometries. If None, the coordinate reference system is set to 'EPSG:4326'.

  • buffer (float, optional) – Buffer ratio to apply to the bounds before clipping the cartopy geometries.

Returns:

GeoDataFrame with cartopy geometries.

Return type:

geopandas.GeoDataFrame

See also: cartopy.feature.

resilientplotterclass.geometries.plot_geometries(gdf, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, append_axes_kwargs=None, **kwargs)[source]

Plot a GeoDataFrame using plot.

Parameters:
  • gdf (geopandas.GeoDataFrame) – GeoDataFrame to plot.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

  • kwargs (dict, optional) – Keyword arguments for geopandas.GeoDataFrame.plot().

Returns:

Axis.

Return type:

matplotlib.axes.Axes

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes, geopandas.GeoDataFrame.plot.

basemaps

resilientplotterclass.basemaps.plot_basemap(crs=None, ax=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None, **kwargs)[source]

Plot a basemap using contextily.

Parameters:
  • crs (pyproj.CRS or rasterio.crs.CRS or str, optional) – Coordinate reference system of the basemap.

  • ax (matplotlib.axes.Axes, optional) – Axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

  • kwargs (dict, optional) – Keyword arguments for contextily.add_basemap().

Returns:

Axis.

Return type:

matplotlib.axes.Axes

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid, contextily.add_basemap.

interactive

class resilientplotterclass.interactive.Draw_Map(**kwargs: Any)[source]

Bases: Map

A class to create a map to draw geometries.

STYLE = {'weight': 2}
get_geometries(crs: str = 'EPSG:4326') GeoDataFrame[source]

Get geometries from the map.

Parameters:

crs (str) – The coordinate reference system to reproject the geometries to.

Returns:

A GeoDataFrame containing the geometries from the map.

Return type:

gpd.GeoDataFrame

set_geometries(gdf: GeoDataFrame) None[source]

Set geometries to the map.

Parameters:

aoi (gpd.GeoDataFrame) – The GeoDataFrame containing the geometries.

Returns:

None

resilientplotterclass.interactive.contour(da, m=None, skip=1, smooth=1, **kwargs)[source]
resilientplotterclass.interactive.contourf(da, m=None, skip=1, smooth=1, **kwargs)[source]
resilientplotterclass.interactive.imshow(da, m=None, skip=1, smooth=1, **kwargs)[source]

Plot data interactively using imshow.

Parameters:
  • da (xarray.DataArray) – Data to plot.

  • m (folium.Map, optional) – Folium map to plot on.

  • skip (int, optional) – Plot every nth value in x and y direction.

  • smooth (int, optional) – Smooth data array with rolling mean in x and y direction.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • kwargs (dict, optional) – Keyword arguments for resilientplotterclass.interactive._explore_image().

Returns:

Plot.

Return type:

folium.Map

resilientplotterclass.interactive.pcolormesh(da, m=None, skip=1, smooth=1, **kwargs)[source]
resilientplotterclass.interactive.plot_basemap(m=None, **kwargs)[source]

Plot basemaps interactively using folium.

Parameters:
  • m (folium.Map, optional) – Folium map to plot on.

  • kwargs (dict, optional) – Keyword arguments for folium.Map().

Returns:

Plot.

Return type:

folium.Map

See also:

folium.TileLayer

resilientplotterclass.interactive.plot_geometries(gdf, m=None, **kwargs)[source]

Plot geometries interactively using folium.

Parameters:
  • gdf (geopandas.GeoDataFrame) – GeoDataFrame to plot.

  • m (folium.Map, optional) – Folium map to plot on.

  • kwargs (dict, optional) – Keyword arguments for geopandas.explore().

Returns:

Plot.

Return type:

folium.Map

See also:

geopandas.explore

resilientplotterclass.interactive.quiver(da, m=None, skip=1, smooth=1, **kwargs)[source]
resilientplotterclass.interactive.scatter(da, m=None, skip=1, smooth=1, **kwargs)[source]
resilientplotterclass.interactive.streamplot(da, m=None, skip=1, smooth=1, **kwargs)[source]

videos

resilientplotterclass.videos.create_video(file_path_images, file_path_video, fps=5, **kwargs)[source]

Create MP4 video.

Parameters:
  • file_path_images (str) – File path to images.

  • file_path_video (str) – File path to video.

  • fps (int, optional) – Frames per second.

  • kwargs (dict, optional) – Keyword arguments for cv2.VideoWriter().

Returns:

None.

Return type:

None

See also: cv2.VideoWriter

axes

resilientplotterclass.axes.append_cbar_axis(ax, append_axes_kwargs=None)[source]

Append a colorbar axis.

Parameters:
  • ax (matplotlib.axes.Axes) – Axis.

  • append_axes_kwargs (dict, optional) – Keyword arguments for mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes().

Returns:

Colorbar axis.

Return type:

matplotlib.axes.Axes

See also:

matplotlib.figure.Figure.colorbar, mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes.

resilientplotterclass.axes.format(ax, data=None, crs=None, xy_unit=None, xlim=None, ylim=None, xlabel_kwargs=None, ylabel_kwargs=None, title_kwargs=None, aspect_kwargs=None, grid_kwargs=None)[source]

Format axis for a DataArray, UgridDataArray or GeoDataFrame.

Parameters:
  • ax (matplotlib.axes.Axes) – Axis.

  • data (xr.DataArray or xugrid.UgridDataArray or gpd.GeoDataFrame, optional) – DataArray, UgridDataArray or GeoDataFrame to rescale. If None, the coordinate reference system is used to create the axis.

  • crs (pyproj.CRS or rasterio.CRS or str, optional) – Coordinate reference system of the data. If None, the data is used to create the axis.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the input data.

  • xlim (list[float], optional) – x limits.

  • ylim (list[float], optional) – y limits.

  • xlabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_xlabel().

  • ylabel_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_ylabel().

  • title_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_title().

  • aspect_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.set_aspect().

  • grid_kwargs (dict, optional) – Keyword arguments for matplotlib.axis.grid().

Returns:

Axis.

Return type:

matplotlib.axes.Axes

See also:

matplotlib.axis.set_xlabel, matplotlib.axis.set_ylabel, matplotlib.axis.set_title, matplotlib.axis.set_aspect, matplotlib.axis.grid.

colormaps

resilientplotterclass.colormaps.plot_colormaps()[source]

Plot colormaps.

returns: None. rtype: None

See also: Plotting Colormaps in Matplotlib.

resilientplotterclass.colormaps.register_colormaps()[source]

Register colormaps.

returns: None. rtype: None

See also: Creating Colormaps in Matplotlib.

rescale

resilientplotterclass.rescale.get_rescale_parameters(data=None, crs=None, xy_unit=None)[source]

Get the scale factor, xlabel and ylabel for data, geometries or a coordinate reference system and unit.

Parameters:
  • data (xarray.DataArray, xarray.Dataset, xugrid.UgridDataArray, xugrid.UgridDataset, geopandas.GeoDataFrame, optional) – Data or geometries to rescale. If None, the crs is used to determine the rescale parameters.

  • crs (pyproj.CRS or rasterio.CRS or str, optional) – Coordinate reference system of the data. If None, the crs is determined automatically based on the data.

  • xy_unit (str, optional) – Unit to rescale the x and y dimensions to. If None, the unit is determined automatically based on the data.

Returns:

Scale factor, xlabel, ylabel.

Return type:

tuple[float, str, str]

resilientplotterclass.rescale.rescale(data, scale_factor=1)[source]

Rescale the x and y dimensions of data or geometries.

Parameters:
  • data (xr.DataArray or xugrid.UgridDataArray or gpd.GeoDataFrame) – Data or geometries to rescale.

  • scale_factor (float, optional) – Scale factor to rescale the x and y dimensions to.

Returns:

Rescaled data or geometries

Return type:

xarray.DataArray, xarray.Dataset, xugrid.UgridDataArray, xugrid.UgridDataset, geopandas.GeoDataFrame

utils

resilientplotterclass.utils.rasterise_uds(uds, ds=None, bounds=None, resolution=None)[source]

Rasterise data.

Parameters:
  • uds (xugrid.UgridDataSet or xugrid.UgridDataArray) – Data to rasterise.

  • ds (xarray.DataSet or xarray.DataArray, optional) – Data to rasterise data on.

  • bounds (tuple, optional) – Bounds of the rasterised data.

  • resolution (float, optional) – Resolution of the rasterised data.

Returns:

Rasterised data.

Return type:

xarray.DataArray

resilientplotterclass.utils.reproject_xugrid(uda, crs, **kwargs)[source]

Reproject data.

Parameters:
  • uda (xugrid.UgridDataArray or xugrid.UgridDataSet) – Data to reproject.

  • crs (str) – Coordinate reference system.

  • kwargs (dict) – Keyword arguments for geopandas.GeoDataFrame.to_crs().

Returns:

Reprojected data.

Return type:

xugrid.UgridDataArray or xugrid.UgridDataSet

See also: geopandas.GeoDataFrame.to_crs.