xarray.Dataset.plot.scatter#
- Dataset.plot.scatter(*args, x=None, y=None, z=None, hue=None, hue_style=None, markersize=None, linewidth=None, figsize=None, size=None, aspect=None, ax=None, row=None, col=None, col_wrap=None, xincrease=True, yincrease=True, add_legend=None, add_colorbar=None, add_labels=True, add_title=True, subplot_kws=None, xscale=None, yscale=None, xticks=None, yticks=None, xlim=None, ylim=None, cmap=None, vmin=None, vmax=None, norm=None, extend=None, levels=None, **kwargs)[source]#
Scatter variables against each other.
Wraps
matplotlib.pyplot.scatter()
.The y DataArray will be used as base, any other variables are added as coords.
- Parameters:
ds (
Dataset
) – Must be 2 dimensional, unless creating faceted plots.x (
Hashable
orNone
, optional) – Coordinate for x axis. If None use ds.dims[1].y (
Hashable
orNone
, optional) – Coordinate for y axis. If None use ds.dims[0].z (
Hashable
orNone
, optional) – If specified plot 3D and use this coordinate for z axis.hue (
Hashable
orNone
, optional) – Dimension or coordinate for which you want multiple lines plotted.markersize (
Hashable
orNone
, optional) – scatter only. Variable by which to vary size of scattered points.linewidth (
Hashable
orNone
, optional) – Variable by which to vary linewidth.row (
Hashable
, optional) – If passed, make row faceted plots on this dimension name.col (
Hashable
, optional) – If passed, make column faceted plots on this dimension name.col_wrap (
int
, optional) – Use together withcol
to wrap faceted plotsax (
matplotlib axes object
, optional) – If None, uses the current axis. Not applicable when using facets.figsize (
Iterable[float]
orNone
, optional) – A tuple (width, height) of the figure in inches. Mutually exclusive withsize
andax
.size (scalar, optional) – If provided, create a new figure for the plot with the given size. Height (in inches) of each plot. See also:
aspect
.aspect (
"auto"
,"equal"
, scalar orNone
, optional) – Aspect ratio of plot, so thataspect * size
gives the width in inches. Only used if asize
is provided.xincrease (
bool
orNone
, default:True
) – Should the values on the x axes be increasing from left to right? if None, use the default for the matplotlib function.yincrease (
bool
orNone
, default:True
) – Should the values on the y axes be increasing from top to bottom? if None, use the default for the matplotlib function.add_legend (
bool
orNone
, optional) – If True use xarray metadata to add a legend.add_colorbar (
bool
orNone
, optional) – If True add a colorbar.add_labels (
bool
orNone
, optional) – If True use xarray metadata to label axesadd_title (
bool
orNone
, optional) – If True use xarray metadata to add a titlesubplot_kws (
dict
, optional) – Dictionary of keyword arguments for matplotlib subplots. Only applies to FacetGrid plotting.xscale (
{'linear', 'symlog', 'log', 'logit'}
orNone
, optional) – Specifies scaling for the x-axes.yscale (
{'linear', 'symlog', 'log', 'logit'}
orNone
, optional) – Specifies scaling for the y-axes.xticks (
ArrayLike
orNone
, optional) – Specify tick locations for x-axes.yticks (
ArrayLike
orNone
, optional) – Specify tick locations for y-axes.xlim (
tuple[float
,float]
orNone
, optional) – Specify x-axes limits.ylim (
tuple[float
,float]
orNone
, optional) – Specify y-axes limits.cmap (matplotlib colormap name or
colormap
, optional) – The mapping from data values to color space. Either a Matplotlib colormap name or object. If not provided, this will be either'viridis'
(if the function infers a sequential dataset) or'RdBu_r'
(if the function infers a diverging dataset). See Choosing Colormaps in Matplotlib for more information.If seaborn is installed,
cmap
may also be a seaborn color palette. Note: ifcmap
is a seaborn color palette,levels
must also be specified.vmin (
float
orNone
, optional) – Lower value to anchor the colormap, otherwise it is inferred from the data and other keyword arguments. When a diverging dataset is inferred, setting vmin or vmax will fix the other by symmetry aroundcenter
. Setting both values prevents use of a diverging colormap. If discrete levels are provided as an explicit list, both of these values are ignored.vmax (
float
orNone
, optional) – Upper value to anchor the colormap, otherwise it is inferred from the data and other keyword arguments. When a diverging dataset is inferred, setting vmin or vmax will fix the other by symmetry aroundcenter
. Setting both values prevents use of a diverging colormap. If discrete levels are provided as an explicit list, both of these values are ignored.norm (
matplotlib.colors.Normalize
, optional) – Ifnorm
hasvmin
orvmax
specified, the corresponding kwarg must beNone
.extend (
{'neither', 'both', 'min', 'max'}
, optional) – How to draw arrows extending the colorbar beyond its limits. If not provided,extend
is inferred fromvmin
,vmax
and the data limits.levels (
int
or array-like, optional) – Split the colormap (cmap
) into discrete color intervals. If an integer is provided, “nice” levels are chosen based on the data range: this can imply that the final number of levels is not exactly the expected one. Settingvmin
and/orvmax
withlevels=N
is equivalent to settinglevels=np.linspace(vmin, vmax, N)
.**kwargs (optional) – Additional arguments to wrapped matplotlib function
- Returns:
artist
– The same type of primitive artist that the wrapped matplotlib function returns