xoa.plot.plot_fields#
- xoa.plot.plot_fields(fields, ncols=None, projection=None, figsize=None, titles=None, colorbar='each', cbar_kwargs=None, map_kw=None, panel_labels=None, **kwargs)[source]#
Plot several fields on maps of a single figure
Each field is drawn with
plot_field()on its own map.- Parameters:
fields (dict, list) – Fields to plot. A dict maps the titles to the fields. An item of a list is either a field or a
(field, kwargs)tuple, where kwargs override the common ones for this field only.ncols (None, int) – Number of columns, which defaults to the number of fields up to three.
projection (None, str, cartopy.crs.Projection) – Projection of the maps, see
xoa.core.plot.get_projection(). The default is the one of the background layer of map_kw, given byxoa.core.plot.get_layer_projection(), else Mercator.figsize (None, tuple) – Size of the figure, which defaults to a size that depends on the grid of axes.
titles (None, list(str)) – Titles, which default to the keys of fields, if it is a dict.
colorbar ({"each", "shared", None}) – One colorbar per map, or a single one shared by all the maps, that is labelled and scaled like the first one, or no colorbar.
cbar_kwargs (None, dict) – Parameters of the colorbars, see
add_colorbar()map_kw (None, dict) – Parameters that decorate the maps, see
plot_field()panel_labels (None, bool, str, dict) – Add labels like “a)” to the maps, see
PanelLabeler. A string is the style and a dict gives the other parameters.kwargs – Extra parameters that are passed to
plot_field(), likecmap,levels,scalebarorcompass
- Returns:
matplotlib.figure.Figure
list(cartopy.mpl.geoaxes.GeoAxes) – Axes of the fields
Example
fig, axes = plot_fields( {"Reanalysis": speed, "Geostrophy": speed_g}, cmap="cmo.tempo", colorbar="shared" ) plot_vectors(u, v, ax=axes[0])
See also