xarray.plot.imshow¶
- xarray.plot.imshow(darray, x=None, y=None, ax=None, row=None, col=None, col_wrap=None, xincrease=True, yincrease=True, add_colorbar=None, add_labels=True, vmin=None, vmax=None, cmap=None, center=None, robust=False, extend=None, levels=None, colors=None, subplot_kws=None, cbar_ax=None, cbar_kwargs=None, **kwargs)¶
Image plot of 2d DataArray using matplotlib.pyplot
Wraps matplotlib.pyplot.imshow
..note:
This function needs uniformly spaced coordinates to properly label the axes. Call DataArray.plot() to check.
The pixels are centered on the coordinates values. Ie, if the coordinate value is 3.2 then the pixels for those coordinates will be centered on 3.2.
Parameters: darray : DataArray
Must be 2 dimensional, unless creating faceted plots
x : string, optional
Coordinate for x axis. If None use darray.dims[1]
y : string, optional
Coordinate for y axis. If None use darray.dims[0]
ax : matplotlib axes object, optional
If None, uses the current axis
row : string, optional
If passed, make row faceted plots on this dimension name
col : string, optional
If passed, make column faceted plots on this dimension name
col_wrap : integer, optional
Use together with col to wrap faceted plots
xincrease : None, True, or False, optional
Should the values on the x axes be increasing from left to right? if None, use the default for the matplotlib function
yincrease : None, True, or False, optional
Should the values on the y axes be increasing from top to bottom? if None, use the default for the matplotlib function
add_colorbar : Boolean, optional
Adds colorbar to axis
add_labels : Boolean, optional
Use xarray metadata to label axes
vmin, vmax : floats, optional
Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments. When a diverging dataset is inferred, setting one of these values will fix the other by symmetry around center. Setting both values prevents use of a diverging colormap. If discrete levels are provided as an explicit list, both of these values are ignored.
cmap : matplotlib colormap name or object, optional
The mapping from data values to color space. If not provided, this will be either be viridis (if the function infers a sequential dataset) or RdBu_r (if the function infers a diverging dataset). When when Seaborn is installed, cmap may also be a seaborn color palette. If cmap is seaborn color palette and the plot type is not contour or contourf, levels must also be specified.
colors : discrete colors to plot, optional
A single color or a list of colors. If the plot type is not contour or contourf, the levels argument is required.
center : float, optional
The value at which to center the colormap. Passing this value implies use of a diverging colormap. Setting it to False prevents use of a diverging colormap.
robust : bool, optional
If True and vmin or vmax are absent, the colormap range is computed with 2nd and 98th percentiles instead of the extreme values.
extend : {‘neither’, ‘both’, ‘min’, ‘max’}, optional
How to draw arrows extending the colorbar beyond its limits. If not provided, extend is inferred from vmin, vmax and the data limits.
levels : int or list-like object, optional
Split the colormap (cmap) into discrete color intervals.
subplot_kws : dict, optional
Dictionary of keyword arguments for matplotlib subplots. Only applies to FacetGrid plotting.
cbar_ax : matplotlib Axes, optional
Axes in which to draw the colorbar.
cbar_kwargs : dict, optional
Dictionary of keyword arguments to pass to the colorbar.
**kwargs : optional
Additional arguments to wrapped matplotlib function
Returns: artist :
The same type of primitive artist that the wrapped matplotlib function returns