plot_map#
- mhm_tools.common.plotter.plot_map(data: DataArray, cb_label: str, title: str, out_path: Path, cmap: str = 'RdBu', x_min: float | None = None, x_max: float | None = None, y_min: float | None = None, y_max: float | None = None, vmin: float | None = None, vmax: float | None = None) None[source]#
Plot and save a 2D DataArray over longitude and latitude using Cartopy.
This function creates a geographically-aware color plot using a discrete colormap, with automatic colorbar extensions when values fall outside the given [vmin, vmax].
- Parameters:
data (xr.DataArray) – 2D input data with ‘lon’ and ‘lat’ coordinates.
cb_label (str) – Label for the colorbar.
title (str) – Title of the plot.
out_path (Path) – Path where the figure will be saved.
cmap (str, optional) – Name of the Matplotlib colormap to use.
x_min, x_max, y_min, y_max (float, optional) – Manual spatial limits for zooming.
vmin, vmax (float, optional) – Color scale limits. If not provided, data min/max are used.