csep.plots.plot_gridded_dataset
- csep.plots.plot_gridded_dataset(gridded, region, basemap=None, projection=None, extent=None, set_global=False, plot_region=True, colorbar=True, colormap='viridis', clim=None, clabel=None, alpha=None, alpha_exp=0, ax=None, show=False, **kwargs)[source]
Plot spatial gridded dataset such as data from a gridded forecast. Can be plotted over a basemap by passing the keyword parameters of the function
plot_basemap(). The color-map can be fine-tuned using the argumentscolorbar,colormap,clim. An exponential transparency function can be set withalphaandalpha_exp.Usage Tutorials
- Parameters:
gridded (numpy.ndarray) – 2D-square array of values corresponding to the region. See
CartesianGrid2Dandget_cartesian()to convert a 1D array (whose indices correspond to each spatial cell) to a 2D-square array.region (CartesianGrid2D) – Region in which gridded values are contained.
basemap (str, optional) – Passed to
plot_basemap()along with kwargs. Possible values are: ‘stock_img’, ‘google-satellite’, ‘ESRI_terrain’, ‘ESRI_imagery’, ‘ESRI_relief’, ‘ESRI_topo’, a custom web service link, or a GeoTiff filepath. Defaults to None.projection (cartopy.crs.Projection or str, optional) – Projection to be used in the underlying basemap. It can be a cartopy projection instance, or approx for a quick approximation of Mercator. Defaults to
PlateCarreeif None.extent (list of float, optional) –
[lon_min, lon_max, lat_min, lat_max]. Defaults to None.set_global (bool, optional) – Display the complete globe as basemap. Defaults to False.
plot_region (bool, optional) – If True, plot the dataset region border. Defaults to True.
colorbar (bool, optional) – If True, include a colorbar. Defaults to True.
colormap (str or matplotlib.colors.Colormap, optional) – Colormap to use. Defaults to ‘viridis’.
clim (tuple of float, optional) – Range of the colorbar. Defaults to None.
clabel (str, optional) – Label of the colorbar. Defaults to None.
alpha (float, optional) – Transparency level. Defaults to None.
alpha_exp (float, optional) – Exponent for the alpha function (recommended between 0.4 and 1). Defaults to 0.
ax (matplotlib.axes.Axes, optional) – Previously defined ax object. Defaults to None.
show (bool, optional) – If True, displays the plot. Defaults to False.
**kwargs (optional) –
Additional keyword arguments to customize the plot:
colorbar_labelsize (int): Font size for the colorbar label.
colorbar_ticksize (int): Font size for the colorbar ticks.
figsize (tuple): The size of the figure.
region_color (str): Color for the region border.
title (str): Title of the plot.
title_fontsize (int): Font size of the plot title.
- Returns:
Matplotlib axes object.
- Return type:
Changed in version 0.8.0: This function was renamed from plot_spatial_dataset. plot_args dictionary is only partially supported and will be removed in v1.0.0. Changed region_border name to plot_region.