xarray.Dataset.plot.streamplot (2024)

Contents

Dataset.plot.streamplot(*args, x=None, y=None, u=None, v=None, hue=None, hue_style=None, row=None, col=None, col_wrap=None, ax=None, figsize=None, size=None, aspect=None, sharex=True, sharey=True, add_guide=None, subplot_kws=None, cbar_kwargs=None, cbar_ax=None, cmap=None, vmin=None, vmax=None, norm=None, infer_intervals=None, center=None, robust=None, colors=None, extend=None, levels=None, **kwargs)[source]#

Plot streamlines of Dataset variables.

Wraps matplotlib.pyplot.streamplot().

Parameters:
  • ds (Dataset)

  • x (Hashable or None, optional) – Variable name for x-axis.

  • y (Hashable or None, optional) – Variable name for y-axis.

  • u (Hashable or None, optional) – Variable name for the u velocity (in x direction).quiver/streamplot plots only.

  • v (Hashable or None, optional) – Variable name for the v velocity (in y direction).quiver/streamplot plots only.

  • hue (Hashable or None, optional) – Variable by which to color scatter points or arrows.

  • hue_style ({'continuous', 'discrete'} or None, optional) – How to use the hue variable:

    • 'continuous' – continuous color scale(default for numeric hue variables)

    • 'discrete' – a color for each unique value, using the default color cycle(default for non-numeric hue variables)

  • row (Hashable or None, optional) – If passed, make row faceted plots on this dimension name.

  • col (Hashable or None, optional) – If passed, make column faceted plots on this dimension name.

  • col_wrap (int, optional) – Use together with col to wrap faceted plots.

  • ax (matplotlib axes object or None, optional) – If None, use the current axes. Not applicable when using facets.

  • figsize (Iterable[float] or None, optional) – A tuple (width, height) of the figure in inches.Mutually exclusive with size and ax.

  • 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 or None, optional) – Aspect ratio of plot, so that aspect * size gives the width ininches. Only used if a size is provided.

  • sharex (bool or None, optional) – If True all subplots share the same x-axis.

  • sharey (bool or None, optional) – If True all subplots share the same y-axis.

  • add_guide (bool or None, optional) – Add a guide that depends on hue_style:

    • 'continuous' – build a colorbar

    • 'discrete' – build a legend

  • subplot_kws (dict or None, optional) – Dictionary of keyword arguments for Matplotlib subplots(see matplotlib.figure.Figure.add_subplot()).Only applies to FacetGrid plotting.

  • cbar_kwargs (dict, optional) – Dictionary of keyword arguments to pass to the colorbar(see matplotlib.figure.Figure.colorbar()).

  • cbar_ax (matplotlib axes object, optional) – Axes in which to draw the colorbar.

  • cmap (matplotlib colormap name or colormap, optional) – The mapping from data values to color space. Either aMatplotlib colormap name or object. If not provided, this willbe either 'viridis' (if the function infers a sequentialdataset) or 'RdBu_r' (if the function infers a divergingdataset).See Choosing Colormaps in Matplotlibfor more information.

    If seaborn is installed, cmap may also be aseaborn color palette.Note: if cmap is a seaborn color palette,levels must also be specified.

  • vmin (float or None, optional) – Lower value to anchor the colormap, otherwise it is inferred from thedata 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 thesevalues are ignored.

  • vmax (float or None, optional) – Upper value to anchor the colormap, otherwise it is inferred from thedata 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 thesevalues are ignored.

  • norm (matplotlib.colors.Normalize, optional) – If norm has vmin or vmax specified, the correspondingkwarg must be None.

  • infer_intervals (bool | None) – If True the intervals are inferred.

  • center (float, optional) – The value at which to center the colormap. Passing this value impliesuse of a diverging colormap. Setting it to False prevents use of adiverging colormap.

  • robust (bool, optional) – If True and vmin or vmax are absent, the colormap range iscomputed with 2nd and 98th percentiles instead of the extreme values.

  • colors (str or array-like of color-like, optional) – A single color or a list of colors. The levels argumentis required.

  • extend ({'neither', 'both', 'min', 'max'}, optional) – How to draw arrows extending the colorbar beyond its limits. If notprovided, extend is inferred from vmin, vmax and the data limits.

  • levels (int or array-like, optional) – Split the colormap (cmap) into discrete color intervals. If an integeris provided, “nice” levels are chosen based on the data range: this canimply that the final number of levels is not exactly the expected one.Setting vmin and/or vmax with levels=N is equivalent tosetting levels=np.linspace(vmin, vmax, N).

  • **kwargs (optional) – Additional keyword arguments to wrapped Matplotlib function.

Contents

xarray.Dataset.plot.streamplot (2024)
Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated:

Views: 6191

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.