enstools.plot.grid¶
- enstools.plot.grid(plot_function, variable, lon=None, lat=None, figure=None, axes=None, shape=None, cmaps=None, **kwargs)¶
Create a multi-panel plot by mapping the first dimension of the input array to a plot function specified in the second argument.
- Parameters:
- plot_functionCallable
the plot function to use. supported are all function in enstools.plot
- variablexarray.DataArray or np.ndarray
the data to plot. Should be an 3d-Array, the first dimension is used to create the grid.
- lonxarray.DataArray or np.ndarray or str
longitude coordinate or name of longitude coordinate. The name may only be used for xarray variables.
- latxarray.DataArray or np.ndarray or str
latitude coordinate or name of longitude coordinate. The name may only be used for xarray variables.
- figurematplotlib.figure.Figure
If provided, this figure instance will be used (and returned), otherwise a new figure will be created.
- axesarray of matplotlib.axes.Axes
if provided, this has to be an array of matplotlib.axes.Axes instances with the desired shape of the plot.
- shapetuple
The shape of the multi-panel plot (nrows, ncols). Not providing shape or axes is an error!
- cmapslist
A list of cmap names. The number of entries has to be the number of panel plots to create.
- **kwargs:
Keyword arguments, they are forwarded top the actual plt function that creates the individual panels
- Returns:
- tuple:
fig, ax, where ax is an array for Axes objects
Examples
>>> fig, ax = grid(contour, data["TOT_PREC"][27, :, :, :], data["rlon"], data["rlat"], shape=(4, 5), cmaps=cmaps, rotated_pole=data["rotated_pole"], colorbar=False)
Example of displaying the result of K-Mean clustering for the COSMO-DE Ensemble. Each cluster has a different colormap.¶