
    dP             #      
   U d dl mZ d dlZd dlZd dlmZmZmZ d dlm	Z	m
Z
mZmZmZmZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, e	rPd d	l-m.Z. d d
l/m0Z0m1Z1 d dl2m3Z3m4Z4 d dl5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z<m=Z= d dl>m?Z? d dl@mAZA d dlBmCZCmDZDmEZEmFZFmGZG d dlmHZH ddiZIdeJd<   dd ZK	 	 ddd*ZLddddddd+dd6ZMedddddddddddddddddd7d7d8ddO            ZNeddddddddddddddddd7d7dPddS            ZNeddddddddddddddddd7d7dTddU            ZNdddddddddddddddddd7d7d8ddWZNedXdddddYdd^            ZOedXdddd_dd`            ZOedXddddaddb            ZOdXdddddYddcZOddddddddddddddddfZPdg ZQddqZReddddddddddddddd7d7ddd7d7ddddddddddddddr!dd            ZSedddddddddddddd7d7ddd7d7dddddddddddddd dd            ZSedddddddddddddd7d7ddd7d7dddddddddddddd dd            ZSeQ	 ddd            ZSd ZTe	 	 ddddddddd7d7dd7ddddd!ddddddddddddddddd            ZUe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZUe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZUeTdd            ZUe	 	 ddddddddd7d7dd7ddddd!ddddddddddddddddd            ZVe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZVe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZVeTdd            ZVe	 	 ddddddddd7d7dd7ddddd!ddddddddddddddddd            ZWe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZWe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZWeTdd            ZWe	 	 ddddddddd7d7dd7ddddd!ddddddddddddddddd            ZXe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZXe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZXeT	 	 	 ddd            ZXe	 	 ddddddddd7d7dd7ddddd!ddddddddddddddddd            ZYe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZYe	 	 dddddddd7d7dd7ddddd!ddddddddddddddddd            ZYeTdd            ZYdS )    )annotationsN)HashableIterableMutableMapping)TYPE_CHECKINGAnyCallableLiteralcastoverload)	broadcast)concat)_easy_facetgrid)_LINEWIDTH_RANGE_MARKERSIZE_RANGE_add_colorbar_add_legend_assert_valid_xy_determine_guide_ensure_plottable_guess_coords_to_plot_infer_interval_breaks_infer_xy_labels
_Normalize_process_cmap_cbar_kwargs_rescale_imshow_rgb_resolve_intervals_1dplot_resolve_intervals_2dplot_update_axesget_axisimport_matplotlib_pyplotlabel_from_attrs)Axes)PathCollectionQuadMesh)Colormap	Normalize)BarContainer)QuadContourSet)	AxesImage)Line3DPoly3DCollection)	ArrayLike)	DataArray)AspectOptionsExtendOptionsHueStyleOptionsScaleOptionsT_DataArray)	FacetGridzscatter.edgecolorswzMutableMapping[str, Any]_stylesdarrayr.   xHashable | Noneyhuereturn2tuple[DataArray, DataArray, DataArray | None, str]c                `   t          | j                  }||t          d          |t          | |d           |t          | |d           |dk    r;d }d }d}|| |         }| }	nB|| }| |         }	n4| j        d         }
| |
         }| }	n|||t          d          ||t          | |d           t	          | ||	          \  }}| |         }|j        dk    r|| j        v ra| j                            |          dk    rdnd}| j        |         }|                     ||d
          }	|                    ||d
          }nBt          dt          | j                  z             | |         j        \  }| |         j        \  }|                     ||          }	nt	          | ||	          \  }}| |         }	|	j        dk    r|| j        v r`| j                            |          dk    rdnd}| j        |         }|                     ||d
          }|	                    ||d
          }	nXt          dt          | j                  z             | |         j        \  }| |         j        \  }|                     ||          }t          | |                   }| |         }||	||fS )Nz2Cannot specify both x and y kwargs for line plots.r8   r:       r   z1For 2D inputs, please specify either hue, x or y.r;   )r7   r8   r:   F)transpose_coordsz3For 2D inputs, hue must be a dimension i.e. one of )
lendims
ValueErrorr   r   ndimindex	transposereprr"   )r7   r8   r:   r;   ndimshuenamehueplthuelabelxpltypltdimxname
otherindexotherdimxdimhuedimynameydims                     :lib/python3.11/site-packages/xarray/plot/dataarray_plot.py_infer_line_datarX   >   s    E}MNNN}C(((}C(((zz=!9DDD]D!9DD +a.C#;DDD 9s{PQQQ9 e444-VqCHHHNE7%=Dy1}}fk))&,k&7&7&@&@A&E&E1J%{:6H!++HgPU+VVD>>(Ge>TTDD$(*.v{*;*;<   !-,"7O0	''f55 .VqCHHHNE7%=Dy1}}fk))&,k&7&7&@&@A&E&E1J%{:6H!++HgPU+VVD>>(Ge>TTDD$(*.v{*;*;<   !-,"7O0	''f55#F7O44vx''    Fr3   coords_to_plotMutableMapping[str, Hashable]plotfunc_name
str | None_is_facetgridbooldict[str, T_DataArray]c           	          j         dk    rg }t          j         j        t          j                  rxdD ]u}|                    |d          }|[| j        v rRt          j                             |di          z  }t           |g|           |
                    ||                    v  j        dg|R                         j                   t                     }|                     fd	|                                D                        t          t!          |                                t%          |                                                     }|S )
a  
    Prepare data for usage with plt.scatter.

    Parameters
    ----------
    darray : T_DataArray
        Base DataArray.
    coords_to_plot : MutableMapping[str, Hashable]
        Coords that will be plotted.
    plotfunc_name : str | None
        Name of the plotting function that will be used.

    Returns
    -------
    plts : dict[str, T_DataArray]
        Dict of DataArrays that will be sent to matplotlib.

    Examples
    --------
    >>> # Make sure int coords are plotted:
    >>> a = xr.DataArray(
    ...     data=[1, 2],
    ...     coords={1: ("x", [0, 1], {"units": "s"})},
    ...     dims=("x",),
    ...     name="a",
    ... )
    >>> plts = xr.plot.dataarray_plot._prepare_plot1d_data(
    ...     a, coords_to_plot={"x": 1, "z": None, "hue": None, "size": None}
    ... )
    >>> # Check which coords to plot:
    >>> print({k: v.name for k, v in plts.items()})
    {'y': 'a', 'x': 1}
    r?   )zr8   N)rO   .)_stacked_dim)r:   c                6    i | ]\  }}||j         |         S N)coords).0kvr7   s      rW   
<dictcomp>z(_prepare_plot1d_data.<locals>.<dictcomp>   s'    QQQA1=FM!===rY   )rE   np
issubdtypedtypefloatinggetrC   naniselr   appendrG   stackdictupdateitemszipkeysr   values)	r7   rZ   r\   r^   dims_Trj   rO   
darray_nanpltss	   `        rW   _prepare_plot1d_datar~      s^   R {Q =r{33 	5 5 5$((D11O#*<*<!#&++sBi*@*@!@J#VZ$8cBBBFMM."3444 "!#//// 6;77 &>>>DKKQQQQ)=)=)?)?QQQ   DIIKKT[[]]!<==>>DKrY   )rowcolcol_wrapaxr;   subplot_kwsr   r   r   
int | Noner   Axes | Noner   dict[str, Any] | Nonekwargsr   c               H   |                                                                  } t          | j                  }|                    |           |                    |           |                    |           t          |          }	|	dk    s| j        dk    rt          d          |	dv rM|s|r||d<   ||d<   ||d<   ||d<   |	dk    rt          }
||d	<   n>|	d
k    r|rt          }
||d	<   n)t          }
||d<   n|s|s|rt          d          t          }
||d<    |
| fi |S )a  
    Default plot of DataArray using :py:mod:`matplotlib:matplotlib.pyplot`.

    Calls xarray plotting function based on the dimensions of
    the squeezed DataArray.

    =============== ===========================
    Dimensions      Plotting function
    =============== ===========================
    1               :py:func:`xarray.plot.line`
    2               :py:func:`xarray.plot.pcolormesh`
    Anything else   :py:func:`xarray.plot.hist`
    =============== ===========================

    Parameters
    ----------
    darray : DataArray
    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 or None, optional
        Use together with ``col`` to wrap faceted plots.
    ax : matplotlib axes object, optional
        Axes on which to plot. By default, use the current axes.
        Mutually exclusive with ``size``, ``figsize`` and facets.
    hue : Hashable or None, optional
        If passed, make faceted line plots with hue on this dimension name.
    subplot_kws : dict, optional
        Dictionary of keyword arguments for Matplotlib subplots
        (see :py:meth:`matplotlib:matplotlib.figure.Figure.add_subplot`).
    **kwargs : optional
        Additional keyword arguments for Matplotlib.

    See Also
    --------
    xarray.DataArray.squeeze
    r   No numeric data to plot.)r?      r   r   r   r   r?   r;   r   zdOnly 1d and 2d plots are supported for facets in xarray. See the package `Seaborn` for more options.r   )squeezecomputesetrC   discardrB   size	TypeErrorline
pcolormeshrD   hist)r7   r   r   r   r   r;   r   r   	plot_dimsrI   plotfuncs              rW   plotr      sy   b ^^%%''FFK  Iccc	NNE zzV[A%%2333 	*# 	*$/F=!F5MF5M!)F:A::HF5MMaZZ 4 #u%(3}% 	# 	 	>   F4L8F%%f%%%rY   T)r   r   figsizeaspectr   r   r;   r8   r:   	xincrease	yincreasexscaleyscalexticksyticksxlimylim
add_legend_labelsargsNoner   Iterable[float] | Noner   r/   r   float | Noner   bool | Noner   r   r2   r   r   ArrayLike | Noner   r   r   r   r   list[Line3D]c                   d S rf    r7   r   r   r   r   r   r   r;   r8   r:   r   r   r   r   r   r   r   r   r   r   r   r   s                         rW   r   r   5  	    2 CrY   )r   r   r   r   r   r;   r8   r:   r   r   r   r   r   r   r   r   r   r   r   FacetGrid[DataArray]c                   d S rf   r   r   s                         rW   r   r   Q  r   rY   )r   r   r   r   r   r;   r8   r:   r   r   r   r   r   r   r   r   r   r   c                   d S rf   r   r   s                         rW   r   r   m  r   rY   #list[Line3D] | FacetGrid[DataArray]c               x   |s|rrt                                                      }|                    |                    d                     |                    d           t	          | t
          fddi|S t          | j                  }|dk    s| j        dk    rt          d          |dk    r#t          d                    |	                    |d
k    r|                    dd
          }nd|vsJ t          ||||          }t          | ||	|          \  }}}}t          |                                |                                |          \  }}}}}t!          ||          } t!          ||          }!t#          ||            |j        ||g|R i |}"|rU| |                    |            |!|                    |!           |                    |                                            | j        dk    r=|r;|J |                    |"t3          |                                          |           t5          j        |j        t4          j                  rA|                                D ],}#|#                    d           |#                     d           -tC          ||
|||||||	  	         |"S )a
  
    Line plot of DataArray values.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.plot`.

    Parameters
    ----------
    darray : DataArray
        Either 1D or 2D. If 2D, one of ``hue``, ``x`` or ``y`` must be provided.
    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.
    figsize : tuple, optional
        A tuple (width, height) of the figure in inches.
        Mutually exclusive with ``size`` and ``ax``.
    aspect : "auto", "equal", scalar or None, optional
        Aspect ratio of plot, so that ``aspect * size`` gives the *width* in
        inches. Only used if a ``size`` is provided.
    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``.
    ax : matplotlib axes object, optional
        Axes on which to plot. By default, the current is used.
        Mutually exclusive with ``size`` and ``figsize``.
    hue : Hashable, optional
        Dimension or coordinate for which you want multiple lines plotted.
        If plotting against a 2D coordinate, ``hue`` must be a dimension.
    x, y : Hashable, optional
        Dimension, coordinate or multi-index level for *x*, *y* axis.
        Only one of these may be specified.
        The other will be used for values from the DataArray on which this
        plot method is called.
    xincrease : bool or None, optional
        Should the values on the *x* axis be increasing from left to right?
        if ``None``, use the default for the Matplotlib function.
    yincrease : bool or None, optional
        Should the values on the *y* axis be increasing from top to bottom?
        if ``None``, use the default for the Matplotlib function.
    xscale, yscale : {'linear', 'symlog', 'log', 'logit'}, optional
        Specifies scaling for the *x*- and *y*-axis, respectively.
    xticks, yticks : array-like, optional
        Specify tick locations for *x*- and *y*-axis.
    xlim, ylim : array-like, optional
        Specify *x*- and *y*-axis limits.
    add_legend : bool, default: True
        Add legend with *y* axis coordinates (2D inputs only).
    *args, **kwargs : optional
        Additional arguments to :py:func:`matplotlib:matplotlib.pyplot.plot`.

    Returns
    -------
    primitive : list of Line3D or FacetGrid
        When either col or row is given, returns a FacetGrid, otherwise
        a list of matplotlib Line3D objects.
    r   r7   kindr   r   r   r   zZLine plots are for 1- or 2-dimensional DataArrays. Passed DataArray has {ndims} dimensions)rI   r   r   extraNhandleslabelstitle   right)"localscopyrv   popr   r   rB   rC   r   r   rD   formatr    rX   r   to_numpyr"   r   r   
set_xlabel
set_ylabel	set_title_title_for_slicerE   legendlistrl   rm   rn   
datetime64get_xticklabelsset_rotationset_horizontalalignmentr   )$r7   r   r   r   r   r   r   r;   r8   r:   r   r   r   r   r   r   r   r   r   r   r   r   allargsrI   rM   rN   rK   	hue_labelxplt_valyplt_valx_suffixy_suffixxlabelylabel	primitivexlabelss$                                       rW   r   r     s   b  Ec E((--//w{{8,,---HvtDD&DGDDDEzzV[A%%2333qyye,,
 
 	
 rzzzz&"%%V####	'4	,	,B$4VQ3$G$G!D$	 6O&6 62Hh(F d(333Fd(333Fh)))(<T<<<V<<I 0MM&!!!MM&!!!
V,,..///{aJ!!!
		)D1B1B,C,C9	UUU 
}TZ// 5))++ 	5 	5G  $$$++G4444Y	66664QUVVVrY   pre)where	drawstyledsr   r   r   Literal['pre', 'post', 'mid']r   r   c                   d S rf   r   r7   r   r   r   r   r   r   r   s           rW   stepr     	     CrY   )r   r   r   r   c                   d S rf   r   r   s           rW   r   r   *  r   rY   )r   r   r   r   c                   d S rf   r   r   s           rW   r   r   8  r   rY   c                   |dvrt          d          |||}nt          d          |d}d|z   |z   }t          | g|R |||d|S )a  
    Step plot of DataArray values.

    Similar to :py:func:`matplotlib:matplotlib.pyplot.step`.

    Parameters
    ----------
    where : {'pre', 'post', 'mid'}, default: 'pre'
        Define where the steps should be placed:

        - ``'pre'``: The y value is continued constantly to the left from
          every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
          value ``y[i]``.
        - ``'post'``: The y value is continued constantly to the right from
          every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
          value ``y[i]``.
        - ``'mid'``: Steps occur half-way between the *x* positions.

        Note that this parameter is ignored if one coordinate consists of
        :py:class:`pandas.Interval` values, e.g. as a result of
        :py:func:`xarray.Dataset.groupby_bins`. In this case, the actual
        boundaries of the interval are used.
    drawstyle, ds : str or None, optional
        Additional drawstyle. Only use one of drawstyle and ds.
    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.
    *args, **kwargs : optional
        Additional arguments for :py:func:`xarray.plot.line`.

    Returns
    -------
    primitive : list of Line3D or FacetGrid
        When either col or row is given, returns a FacetGrid, otherwise
        a list of matplotlib Line3D objects.
    >   midr   postz7'where' argument to step must be 'pre', 'post' or 'mid'Nz'ds and drawstyle are mutually exclusiver@   zsteps-)r   r   r   )rD   r   r   r   s           rW   r   r   F  s    ^ ***RSSS	~IIEFFF	5 9,IOOOOOOOOrY   )r   r   r   r   r   r   r   r   r   r   r   r   +tuple[np.ndarray, np.ndarray, BarContainer]c                  t          |          dk    sJ | j        dk    s| j        dk    rt          d          t	          ||||          }t          j        |                                           }|t          j	        |                   } |j
        |fi |}|                    |                                            |                    t          |                      t          ||||||	|
||	  	         |S )a  
    Histogram of DataArray.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.hist`.

    Plots *N*-dimensional arrays by first flattening the array.

    Parameters
    ----------
    darray : DataArray
        Can have any number of dimensions.
    figsize : Iterable of float, optional
        A tuple (width, height) of the figure in inches.
        Mutually exclusive with ``size`` and ``ax``.
    aspect : "auto", "equal", scalar or None, optional
        Aspect ratio of plot, so that ``aspect * size`` gives the *width* in
        inches. Only used if a ``size`` is provided.
    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``.
    ax : matplotlib axes object, optional
        Axes on which to plot. By default, use the current axes.
        Mutually exclusive with ``size`` and ``figsize``.
    xincrease : bool or None, optional
        Should the values on the *x* axis be increasing from left to right?
        if ``None``, use the default for the Matplotlib function.
    yincrease : bool or None, optional
        Should the values on the *y* axis be increasing from top to bottom?
        if ``None``, use the default for the Matplotlib function.
    xscale, yscale : {'linear', 'symlog', 'log', 'logit'}, optional
        Specifies scaling for the *x*- and *y*-axis, respectively.
    xticks, yticks : array-like, optional
        Specify tick locations for *x*- and *y*-axis.
    xlim, ylim : array-like, optional
        Specify *x*- and *y*-axis limits.
    **kwargs : optional
        Additional keyword arguments to :py:func:`matplotlib:matplotlib.pyplot.hist`.

    r   r   )rB   rE   r   r   r    rl   ravelr   pdnotnullr   r   r   r   r"   r   )r7   r   r   r   r   r   r   r   r   r   r   r   r   r   r   no_nanr   s                    rW   r   r     s    p t99>>>>{a6;!++2333	'4	,	,BXfoo''((FBJv&&'F))&))ILL((**+++MM"6**+++Y	66664QUVVVrY   c           #          d} j          d|  _         t          j         d          dddddddddddddddddddddddddddddddddd!d> fd=            }|`|S )?z'Decorator for common 1d plotting logic.aW  
    Parameters
    ----------
    darray : DataArray
        Must be 2 dimensional, unless creating faceted plots.
    x : Hashable or None, optional
        Coordinate for x axis. If None use darray.dims[1].
    y : Hashable or None, optional
        Coordinate for y axis. If None use darray.dims[0].
    z : Hashable or None, optional
        If specified plot 3D and use this coordinate for *z* axis.
    hue : Hashable or None, optional
        Dimension or coordinate for which you want multiple lines plotted.
    hue_style: {'discrete', 'continuous'} 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)

    markersize: Hashable or None, optional
        scatter only. Variable by which to vary size of scattered points.
    linewidth: Hashable or None, 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 with ``col`` to wrap faceted plots
    ax : matplotlib axes object, optional
        If None, uses the current axis. 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 in
        inches. Only used if a ``size`` is provided.
    xincrease : bool or None, 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 or None, 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 or None, optional
        If True use xarray metadata to add a legend.
    add_colorbar : bool or None, optional
        If True add a colorbar.
    add_labels : bool or None, optional
        If True use xarray metadata to label axes
    add_title : bool or None, optional
        If True use xarray metadata to add a title
    subplot_kws : dict, optional
        Dictionary of keyword arguments for matplotlib subplots. Only applies
        to FacetGrid plotting.
    xscale : {'linear', 'symlog', 'log', 'logit'} or None, optional
        Specifies scaling for the x-axes.
    yscale : {'linear', 'symlog', 'log', 'logit'} or None, optional
        Specifies scaling for the y-axes.
    xticks : ArrayLike or None, optional
        Specify tick locations for x-axes.
    yticks : ArrayLike or None, optional
        Specify tick locations for y-axes.
    xlim : ArrayLike or None, optional
        Specify x-axes limits.
    ylim : ArrayLike or None, 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 :doc:`Choosing Colormaps in Matplotlib <matplotlib:tutorials/colors/colormaps>`
        for more information.

        If *seaborn* is installed, ``cmap`` may also be a
        `seaborn color palette <https://seaborn.pydata.org/tutorial/color_palettes.html>`_.
        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 the
        data and other keyword arguments. When a diverging dataset is inferred,
        setting `vmin` or `vmax` 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.
    vmax : float or None, 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 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.
    norm : matplotlib.colors.Normalize, optional
        If ``norm`` has ``vmin`` or ``vmax`` specified, the corresponding
        kwarg must be ``None``.
    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 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.
        Setting ``vmin`` and/or ``vmax`` with ``levels=N`` is equivalent to
        setting ``levels=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
    

__module____name____qualname____doc__assignedNT)!r8   r:   rb   r;   	hue_style
markersize	linewidthr   r   r   r   r   r   r   r   r   r   add_colorbar
add_labels	add_titler   r   r   r   r   r   r   cmapvminvmaxnormextendlevelsr7   r.   r   r   r8   r9   r:   rb   r;   r   r1   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   bool | Iterable[bool]r   r_   r   r   r   r2   r   r   r   r   r   r   r   str | Colormap | Noner   r   r   Normalize | Noner   r0   r   r<   c       !          : t                      }$|t                      }|s|	r||                    d           t                                                      }%|%                    |%                    d                     |%                    d           |%                    d           t                      ;j                 |%d<   t          | fddi|%S | j	        d	k    s| j
        d	k    rt          d
          |"dk    r|#                    dd          }"|"rd|#vsJ d}&|J |"d	         }t          |"          dk    r|J |"d         }t          |"          dk    r|J |"d         }t          |"          dk    r|J |"d         }t          |"          dk    rt          |&          t          j        |&t           d           ~"|#                    dd          }';j        dk    r|#                    d|          }(t"          })n|#                    d|          }(t$          })t          ||||(          }*|'st'          | |*|#          }*t)          | |*;j                  }+|+                    dd           },|+                    dd           }-|+                    dd           }.|#                    |.           |+                    dd           }/|+                    dd           }0t+          |/          }1|#                    |1j                   t+          |0|)|'           }2|#                    |2j        !           |#                    d"i           }3|#                    d#i           }4|1j        |1j        s<|4                    |1j        |1j        $           |#                    d%|1j                  }!t;          ;t=          d&|1j                  j        fi t                      \  :}4|3s:fd'd(D             }5 |3j        di |5 |$                    t@                    5  |A||                    d           tC          ||||fi |}|"                    d)d)d*           ntC          ||||fi |} ;|,|-f||d+|3|#}6d d d            n# 1 swxY w Y   tG          j$        tG          j%        |                    r)|r'|&                    | '                                           tQ          |1|2||;j        ,          \  }7}8|7rBd-|4vrtS          |1j                  |4d-<   tU          |6||#                    d.d           |4:           |8r;j        d/v r-tW          |s|7s|1nt+          d           |2|6|;j        0           n|1j        5tY          t=          d&|1j                  -                                          }9n|1j        g}9;j        d1k    r1|.                    |6d2         |9tS          |1j                  3           n*|.                    |6|9tS          |1j                  3           t_          |||||||||	  	         |6S )4N3d)
projectionr   r7   pltr   r   plot1dr   r   r   r   YUsing positional arguments is deprecated for plot methods, use keyword arguments instead.r?   r         
stacklevelr^   Fscatter_size)r8   rb   r;   r   r8   r:   rb   )zpltr;   r   )data)rK   )r  widthr^   )sizepltcmap_params_subsetcbar_kwargs)r   ticksr   r.   c                "    i | ]}||         S r   r   )rh   vvcmap_paramss     rW   rk   z0_plot1d.<locals>.newplotfunc.<locals>.<dictcomp>  s    VVVrr;r?VVVrY   )r   r   r   r   r   )azimelevvertical_axis)r   r   )r\   labelcbar_ax)r  r   )	legend_axr   r   rc   r   )0r!   ru   rv   r   r   r   globalsr   r   rE   r   r   rB   rD   warningswarnDeprecationWarningr   r   r   r~   r   rz   r  data_is_numericr   r  rp   r   r   r   
rc_contextr6   r    	view_initrl   anyasarrayr   r   r   r"   r   r   r   r   r   r   )<r7   r8   r:   rb   r;   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   msgr^   size_size_rrZ   r}   rM   rN   r  rK   r  hueplt_normsizeplt_normr  r  ckwr   add_colorbar_add_legend_hueplt_norm_valuesr  r   s<                                                             @rW   newplotfuncz_plot1d.<locals>.newplotfuncO  st   X '((&&K  
	E# 
	E}""d"333hhmmooGNN7;;x00111KK!!!KK")))H,=">GJ"6DDDGDDD;!v{a//6777 2::::fb))D 	E''''mC999QA4yy1}}yyyG4yy1}}yyyG4yy1}}{{{1g4yy1}} oo%c#5!DDDD

?E::	))JJw
33E&FFJJw	22E%F @D1#E@
 @
 @
  	S26>6RRN#FNH<MNNxxT""xxT""xxT""4   %&&((64(( !f---[/000!m
 
 
 	l1222#ZZ(<bAAjj33'. B""+*<KDU"VVVHk.@AA'@[+"455:( ( ((( ($K & 1VVVV5UVVV)")00C000^^G$$ 	 	}:&&$&777gtVRGG;GG "2SAAAAgtVRGG;GG  %	 
 %  I	 	 	 	 	 	 	 	 	 	 	 	 	 	 	( 6"*Z(()) 	4i 	4LL0022333%5"+&
 &
 &
"{  	k))'78H'I'IG$2vzz)T::K    	 $777!*)6*KK#D))  %.     #/)-[+*:;;DDFF* *&& +6*:);&$..II )"1.{/?@@      II )1.{/?@@     		9ffffdD	
 	
 	
 s   #A#RRR)Hr7   r.   r   r   r8   r9   r:   r9   rb   r9   r;   r9   r   r1   r   r9   r   r9   r   r9   r   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r   r<   r   r   	functoolswraps__wrapped__r   	commondocr/  s   `  rW   _plot1dr6    s    wIt #*99i99H_P   "!!#%)&*%)###*.!#!%!%"&$(,0-1###'#'!%!%&*!!!% $#'GW W W W W W W Wx 	rY   r   r   darraysIterable[DataArray]suffixesIterable[str]rotate_labelsIterable[bool]r#   c                   t          | t                    r| gdz  n| } t          d| |||          D ]\  }}}}}	||r0t          ||          }
|
 t	          |d| d          |
           |	rmt          j        |j        t
          j                  rI t	          |d| d                      D ],}|	                    d           |
                    d	           -d S )
Nr  r8   r:   rb   r   set_r  get_
ticklabelsr   r   )
isinstancer_   rx   r"   getattrrl   rm   rn   r   r   r   )r   r7  r9  r;  r   axis	add_labelr7   suffixrotate_labelr  r   s               rW   _add_labelsrH  3  s'    &0
D%A%AQ*!!zJ9<Wh: : 8 85i > 	7$V6:::E /.4...//666 	8BM&,FF 	8
 ?'"&=T&=&=&=>>@@ 8 8##B'''..w7777%8 8rY   )!r8   r:   rb   r;   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   r   r1   r   r   r   r   r   r   r   r   r   r   r   r0   r   r$   c       !            d S rf   r   $r7   r8   r:   rb   r;   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s$                                       rW   r  r  Q  
    N CrY   ) r8   r:   rb   r;   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c       !            d S rf   r   rJ  s$                                       rW   r  r  {  rK  rY   ) r8   r:   rb   r;   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c       !            d S rf   r   rJ  s$                                       rW   r  r    rK  rY   rM   DataArray | NonerN   c                ^   d|v sd|v rt          d          |                    dd          }|                    dd          }|                    dd          }|:|                    |                                                                           |:|                    |                                                                	           g d
}t          | ||
          fd|D             }	d |	D             }
 |j        d |
D             i |}t          ||
dd|           |S )zfScatter variables against each other.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.scatter`.
    urj   z&u, v are not allowed in scatter plots.r  NrK   r  )c)sr>  c                     g | ]
}|         S r   r   )rh   rj   	plts_dicts     rW   
<listcomp>zscatter.<locals>.<listcomp>  s    555QIaL555rY   c                    g | ]}||S rf   r   rh   ps     rW   rU  zscatter.<locals>.<listcomp>  s    555!q}A}}}rY   c                Z    g | ](}|                                                                 )S r   )r   r   rW  s     rW   rU  zscatter.<locals>.<listcomp>  s,    @@@aQZZ\\//11@@@rY   )r@   r@   r@   )TFF)rD   r   rv   r   r   ru   r  rH  )rM   rN   r   r   r   r  rK   r  
axis_orderplts_or_noner}   r   rT  s               @rW   r  r    sK    f}}vABBB#ZZ55D%zz(D99F &

9d ; ;G))//11222((**0022333 J-1DDD-I-I-II5555*555L55|555D
@@4@@@KFKKI
D,0DbIIIrY   c           "          d} j          d|  _         t          j         d          ddddddddddddddddddddddddddddddddd d= fd<            }|`|S )>z'Decorator for common 2d plotting logic.a  
    Parameters
    ----------
    darray : DataArray
        Must be two-dimensional, unless creating faceted plots.
    x : Hashable or None, optional
        Coordinate for *x* axis. If ``None``, use ``darray.dims[1]``.
    y : Hashable or None, optional
        Coordinate for *y* axis. If ``None``, use ``darray.dims[0]``.
    figsize : Iterable or 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* in
        inches. Only used if a ``size`` is provided.
    ax : matplotlib axes object, optional
        Axes on which to plot. By default, use the current axes.
        Mutually exclusive with ``size`` and ``figsize``.
    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.
    xincrease : None, True, or False, optional
        Should the values on the *x* axis 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* axis be increasing from top to bottom?
        If ``None``, use the default for the Matplotlib function.
    add_colorbar : bool, optional
        Add colorbar to axes.
    add_labels : bool, optional
        Use xarray metadata to label axes.
    vmin : float or None, 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 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.
    vmax : float or None, 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 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 colormap, 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).
        See :doc:`Choosing Colormaps in Matplotlib <matplotlib:tutorials/colors/colormaps>`
        for more information.

        If *seaborn* is installed, ``cmap`` may also be a
        `seaborn color palette <https://seaborn.pydata.org/tutorial/color_palettes.html>`_.
        Note: if ``cmap`` is a seaborn color palette and the plot type
        is not ``'contour'`` or ``'contourf'``, ``levels`` must also be specified.
    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 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.
        Setting ``vmin`` and/or ``vmax`` with ``levels=N`` is equivalent to
        setting ``levels=np.linspace(vmin, vmax, N)``.
    infer_intervals : bool, optional
        Only applies to pcolormesh. If ``True``, the coordinate intervals are
        passed to pcolormesh. If ``False``, the original coordinates are used
        (this can be useful for certain map projections). The default is to
        always infer intervals, unless the mesh is irregular and plotted on
        a map projection.
    colors : str or array-like of color-like, optional
        A single color or a sequence of colors. If the plot type is not ``'contour'``
        or ``'contourf'``, the ``levels`` argument is required.
    subplot_kws : dict, optional
        Dictionary of keyword arguments for Matplotlib subplots. Only used
        for 2D and faceted plots.
        (see :py:meth:`matplotlib:matplotlib.figure.Figure.add_subplot`).
    cbar_ax : matplotlib axes object, optional
        Axes in which to draw the colorbar.
    cbar_kwargs : dict, optional
        Dictionary of keyword arguments to pass to the colorbar
        (see :meth:`matplotlib:matplotlib.figure.Figure.colorbar`).
    xscale : {'linear', 'symlog', 'log', 'logit'} or None, optional
        Specifies scaling for the x-axes.
    yscale : {'linear', 'symlog', 'log', 'logit'} or None, optional
        Specifies scaling for the y-axes.
    xticks : ArrayLike or None, optional
        Specify tick locations for x-axes.
    yticks : ArrayLike or None, optional
        Specify tick locations for y-axes.
    xlim : ArrayLike or None, optional
        Specify x-axes limits.
    ylim : ArrayLike or None, optional
        Specify y-axes limits.
    norm : matplotlib.colors.Normalize, optional
        If ``norm`` has ``vmin`` or ``vmax`` specified, the corresponding
        kwarg must be ``None``.
    **kwargs : optional
        Additional keyword arguments to wrapped Matplotlib function.

    Returns
    -------
    artist :
        The same type of primitive artist that the wrapped Matplotlib
        function returns.
    r   r   r   NTF) r8   r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   centerrobustr   r   infer_intervalscolorsr   r  r  r   r   r   r   r   r   r   r7   r.   r   r   r8   r9   r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r]  r^  r   r0   r   r   r`  str | ArrayLike | Noner   r   r  r  r   r2   r   r   r   r   r   r   r   r   r<   c                L  < |!rkd}#|J |!d         }t          |!          dk    r|J |!d         }t          |!          dk    rt          |#          t          j        |#t          d           ~!|d}=j        dk    s=j        dk    r|d	}=j        d
k    o| j        d|d uz   |d uz   k    }$|$r2d	}|s||*t          |                                 |||          } d\  }}}|t                      }=j        dk    r(|"
                    dd	          s|ddlm}% ~%d|d<   d	}&d	}'|s|ryt                                                      }(|(d= |(d= |(                    |(                    d                     t#                      =j                 |(d<   t%          | fddi|(S | j        dk    s| j        dk    rt)          d          t+                      })=j        dk    rE|"
                    dd	          s/|-dd l}*t/          ||*j        j                  st          d          |"                    dd           }+|+=j        d
k    rt          d          |+|$st          d          t3          | |||$|+          \  },}-| |,         }.| |-         }/|.j        dk    s|/j        dk    s=j        dk    r2|.                    |           }.|/                    |           }/| j        }0n|/j        d         |.j        d         f}0|$r'|-|,f<<t9          <fd| j        D                       z   }0|0| j        k    r | j        |0ddi} |.                                }1|/                                }2|                     d	          }3tA          |1=j                  \  }4}5tA          |2=j                  \  }6}7tC          |4|6|3           tE          =|3j#        fi t                      d|"                    dd	          i\  }8}d=j        v r5|8d          |"d <   |8d!         |"d!<   t/          |tH                    r
d |8d"<   ||"d#<   d$=j        k    r||"d%<   ||"d&<   ||"d'<   d
=j        k    r$t/          |tH                    rt          d(          tK          ||||fi |} =|4|6|3f||8d"         |8d)         |8d*         |8d+         d,|"}9|r|&                    tO          | |,         |5                     |(                    tO          | |-         |7                     |)                    | *                                           =j        dk    r"|+                    tO          |                      |r,|rd-|vrtO          |           |d-<   tY          |9||||8          }:n||rt          d.          d/|"v rd }t[          ||
|||||||	  	         t]          j/        |4j0        t\          j1                  rA|2                                D ],};|;3                    d0           |;4                    d1           -|9S )2Nr  r   r?   r   r	  TcontoursurfaceFimshowr  )NNFr^   )Axes3Dr  r  r7   
imshow_rgbr   r   r   	dataarrayr   zEIf ax is passed to surface(), it must be created with projection="3d"rgbz,The "rgb" keyword is only valid for imshow()zVThe "rgb" keyword is only valid for imshow()with a three-dimensional array (per facet))r7   r8   r:   re  ri  c              3  $   K   | ]
}|v|V  d S rf   r   )rh   dyx_dimss     rW   	<genexpr>z/_plot2d.<locals>.newplotfunc.<locals>.<genexpr>  s-      "N"NQg=M=M1=M=M=M=M"N"NrY   rA   )r   r   r   r   r`  r   r_  r   r   z6plt.imshow's `aspect` kwarg is not available in xarrayr   r   r   )r   r   r   r   r   r  z>cbar_ax and cbar_kwargs can't be used with add_colorbar=False.originr   r   )5rB   rD   r  r  r   r   rE   r   as_numpyru   rp   mpl_toolkits.mplot3drf  r   r   rv   r   r  r   r   r   r!   mpl_toolkitsrB  mplot3dr   broadcast_likerC   tuplerG   r   to_masked_arrayr   r   r   r  strr    r   r"   r   r   r   
set_zlabelr   r   rl   rm   rn   r   r   r   r   )>r7   r8   r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]  r^  r   r   r_  r`  r   r  r  r   r   r   r   r   r   r   r   r   r&  rg  rf  sharexshareyr   r  rq  ri  xlabylabxvalyvalrC   xvalnpyvalnpzvalrM   
xlab_extrarN   
ylab_extrar  r   cbarr   rl  r   s>                                                               @rW   r/  z_plot2d.<locals>.newplotfuncq  s   T  	EmC999QA4yy1}}yyyG4yy1}} oo%c#5!DDDD L I--!Y..4<$&(2 
v{D!S_58

  	7 L  7)T-=,V__->->dFSS%6"dF&&K	))&**_e2T2T)z 877777  -1L) FF  	H# 	HhhmmooG!%NN7;;x00111")))H,=">GJ"6GGGwGGG;!v{a//6777&(( **JJ66 +b,"6"=>>  &  
 jj%%?x0H<<KLLL_Z_=  
 &Q!JC
 
 

d d|d|9q==DIMMX->)-K-K &&v..D&&v..D;DDIaL$)A,/D  	O TlGU"N"N"N"Nfk"N"N"NNNND6;%V%tCdCCF  %%5%11 5VX=NOOj4VX=NOOj$d+++#<I$
 $
 hh$
 $
 !**_e<<	$
 $
 $
 [ )))  +84F8*84F8 &#&& *&*F##)x 8,,,(7F$%%F8%F8x(((Z-D-D(UVVVgtVR??;??H

 V$V$V$V$

 

 

 

	  	8MM*6$<DDEEEMM*6$<DDEEELL0022333 I--.v66777 	 @g[88'7'?'?G$ BkRRDD K P  
 vI	9ffffdD	
 	
 	
 =R]33 	9--// 9 9$$R(((//8888rY   )Fr7   r.   r   r   r8   r9   r:   r9   r   r   r   r   r   r   r   r   r   r9   r   r9   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r   r0  r4  s   `  rW   _plot2dr    s    wIt #*99i99H_P   "!*.!####!%!%$(!!&*# $#')--1#-1###'#'!%!%!%Ex x x x x x x xz 	rY   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]  r^  r   r   r_  r`  r   r  r  r   r   r   r   r   r   r   r]  r^  r`  ra  r  r  r*   c                   d S rf   r   "r7   r8   r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]  r^  r   r   r_  r`  r   r  r  r   r   r   r   r   r   r   r   s"                                     rW   re  re  v  
    L CrY   )r   r   r   r   r   r   r   r   r   r   r   r   r   r]  r^  r   r   r_  r`  r   r  r  r   r   r   r   r   r   r   c                   d S rf   r   r  s"                                     rW   re  re    r  rY   )r   r   r   r   r   r   r   r   r   r   r   r   r   r]  r^  r   r   r_  r`  r   r  r  r   r   r   r   r   r   r   c                   d S rf   r   r  s"                                     rW   re  re    r  rY   
np.ndarraynp.ma.core.MaskedArrayc                   | j         dk    s|j         dk    rt          d          d } ||           \  }} ||          \  }}	ddd}
t          |d          sd|
d	<   |
                    |           |
d
         dk    r
|||	|g|
d<   n	||||	g|
d<   |j         dk    r|j        d         dk    rt
          j                            |j        dd         dz   |j                  }t          j	        |j        t
          j
                  r|dz  }t
          j                            ||fd          }n|                                }d|t          j        |j        d          df<    |j        |fi |
}d| fd|ffD ]}\  }}t          j	        |j        t                     rY t#          |d| d          t          j        t'          |                                t#          |d| d          |           ~|S )az  
    Image plot of 2D DataArray.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.imshow`.

    While other plot methods require the DataArray to be strictly
    two-dimensional, ``imshow`` also accepts a 3D array where some
    dimension can be interpreted as RGB or RGBA color channels and
    allows this dimension to be specified via the kwarg ``rgb=``.

    Unlike :py:func:`matplotlib:matplotlib.pyplot.imshow`, which ignores ``vmin``/``vmax``
    for RGB(A) data,
    xarray *will* use ``vmin`` and ``vmax`` for RGB(A) data
    by applying a single scaling factor and offset to all bands.
    Passing  ``robust=True`` infers ``vmin`` and ``vmax``
    :ref:`in the usual way <robust-plotting>`.
    Additionally the y-axis is not inverted by default, you can
    restore the matplotlib behavior by setting `yincrease=False`.

    .. note::
        This function needs uniformly spaced coordinates to
        properly label the axes. Call :py:meth:`DataArray.plot` to check.

    The pixels are centered on the coordinates. For example, if the coordinate
    value is 3.2, then the pixels for those coordinates will be centered on 3.2.
    r?   zBimshow requires 1D coordinates, try using pcolormesh or contour(f)c                    t          j        | j        t                    rdt	          |           dz
  fS 	 d| d         | d         z
  z  }n# t
          $ r d}Y nw xY w| d         |z
  | d         |z   fS )z%Center the pixels on the coordinates.g      g      ?r?   r   g?rc   )rl   rm   rn   rv  rB   
IndexError)r8   xsteps     rW   _center_pixelszimshow.<locals>._center_pixels  s    =#&& 	) CFFSL((	1Q4!A$;'EE 	 	 	EEE	 te|QrUU]**s   A
 
AAuppernearest)rn  interpolationr  autor   rn  extentr  rc   Nr   )r?   )rn      )rD  r   r8   r:   r?  r  rA  )rE   rD   hasattrrv   shaperl   maonesrn   rm   integerconcatenater   r$  maskre  rv  rC  arangerB   )r8   r:   rb   r   r   r  leftr   topbottomdefaultsalphar   rD  rj   s                  rW   re  re    sC   > 	v{{afkkP
 
 	
+ + +$ !.##KD% .##KC*1INNH2|$$ $# OOFW$$"E637"E37v{{ 72;!EJJqwrr{T1JAAE}QWbj11 !!1e*1!55AAA)*"&b
!
!
!2
%&	!((x((I !HsAh' 4 4a=#&& 	4+GB*t***++BIc!ff,=,=>>>0GB/t///00333rY   r)   c                   d S rf   r   r  s"                                     rW   rc  rc  Q  r  rY   c                   d S rf   r   r  s"                                     rW   rc  rc  z  r  rY   c                   d S rf   r   r  s"                                     rW   rc  rc    r  rY   c                &     |j         | ||fi |}|S )zc
    Contour plot of 2D DataArray.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.contour`.
    )rc  r8   r:   rb   r   r   r   s         rW   rc  rc    s'     
1a--f--IrY   c                   d S rf   r   r  s"                                     rW   contourfr    r  rY   c                   d S rf   r   r  s"                                     rW   r  r    r  rY   c                   d S rf   r   r  s"                                     rW   r  r  +  r  rY   c                &     |j         | ||fi |}|S )zk
    Filled contour plot of 2D DataArray.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.contourf`.
    )r  r  s         rW   r  r  T  s'     Aq!..v..IrY   r%   c                   d S rf   r   r  s"                                     rW   r   r   a  r  rY   c                   d S rf   r   r  s"                                     rW   r   r     r  rY   c                   d S rf   r   r  s"                                     rW   r   r     r  rY   ScaleOptions | Nonec                T   t          j        |           } |0t          |d          rt          | j                  dk    rd}nd}nd}t          d | |fD                       rd}|rt          j        |           d         t          j        |          d         k    sA| j        dk    rxt          j        |           d         t          j        |          d         k    rB| j        dk    rt          | d|          } n$t          | d|	          } t          | d|	          } |rxt          j        |          d         t          j        |          d         k    rB|j        dk    rt          |d|          }n$t          |d|	          }t          |d|	          }|                    d            |j	        | ||fi |}t          |d          sZ| j        dk    rO|j        dk    rD|
                    | d         | d
                    |                    |d         |d
                    |S )zj
    Pseudocolor plot of 2D DataArray.

    Wraps :py:func:`matplotlib:matplotlib.pyplot.pcolormesh`.
    Nr  r?   TFc              3  T   K   | ]#}t          j        |j        t                    V  $d S rf   )rl   rm   rn   rv  )rh   ri   s     rW   rm  zpcolormesh.<locals>.<genexpr>  s0      
7
712=#&&
7
7
7
7
7
7rY   r   )check_monotonicscale)rD  r  rc   )rl   r%  r  rB   r  r$  rE   r   gridr   set_xlimset_ylim)	r8   r:   rb   r   r   r   r_  r   r   s	            rW   r   r     s#   $ 	
1A2|$$ 	#17||q  "&"'"O

7
7A
7
7
777   	@	!Q28A;;q>	)	)VaZZbhqkk!nA>>6Q;;&q$fMMMAA 'qq???A&qq???A @BHQKKNbhqkk!n<<6Q;;&q$fMMMAA 'qq???A&qq???AGGENNNaA0000I 2|$$ !11
AaD!B%   
AaD!B%   rY   r,   c                   d S rf   r   r  s"                                     rW   rd  rd  	  r  rY   c                   d S rf   r   r  s"                                     rW   rd  rd  E	  r  rY   c                   d S rf   r   r  s"                                     rW   rd  rd  n	  r  rY   c                &     |j         | ||fi |}|S )zy
    Surface plot of 2D DataArray.

    Wraps :py:meth:`matplotlib:mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface`.
    )plot_surfacer  s         rW   rd  rd  	  s'      1a22622IrY   )
r7   r.   r8   r9   r:   r9   r;   r9   r<   r=   )NF)
r7   r3   rZ   r[   r\   r]   r^   r_   r<   r`   )r7   r.   r   r9   r   r9   r   r   r   r   r;   r9   r   r   r   r   r<   r   ).r7   r.   r   r   r   r   r   r   r   r   r   r/   r   r   r   r   r;   r9   r8   r9   r:   r9   r   r   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r_   r   r_   r   r   r<   r   ),r   r   r   r   r   r9   r   r   r   r/   r   r   r   r   r;   r9   r8   r9   r:   r9   r   r   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r_   r   r_   r   r   r<   r   ),r   r   r   r9   r   r   r   r   r   r/   r   r   r   r   r;   r9   r8   r9   r:   r9   r   r   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r_   r   r_   r   r   r<   r   ).r7   r.   r   r   r   r9   r   r9   r   r   r   r/   r   r   r   r   r;   r9   r8   r9   r:   r9   r   r   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r_   r   r_   r   r   r<   r   )r7   r.   r   r   r   r   r   r]   r   r]   r   r   r   r   r   r   r<   r   )r7   r.   r   r   r   r   r   r]   r   r]   r   r   r   r9   r   r   r<   r   )r7   r.   r   r   r   r   r   r]   r   r]   r   r9   r   r   r   r   r<   r   )r7   r.   r   r   r   r   r   r]   r   r]   r   r9   r   r9   r   r   r<   r   ) r7   r.   r   r   r   r   r   r   r   r/   r   r   r   r   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r<   r   )r   r   r7  r8  r9  r:  r;  r<  r   r#   r<   r   )Hr7   r.   r   r   r8   r9   r:   r9   rb   r9   r;   r9   r   r1   r   r9   r   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r   r<   r$   )Hr7   r.   r   r   r8   r9   r:   r9   rb   r9   r;   r9   r   r1   r   r9   r   r9   r   r   r   r   r   r   r   r   r   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r   r<   r   )Hr7   r.   r   r   r8   r9   r:   r9   rb   r9   r;   r9   r   r1   r   r9   r   r9   r   r   r   r   r   r   r   r   r   r   r   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r   r<   r   )T)
rM   rN  rN   rN  r   r#   r   r   r<   r$   )NN)Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r*   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r/   r   r   r   r9   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r/   r   r   r   r   r   r9   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r   )r8   r  r:   r  rb   r  r   r#   r   r   r<   r*   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r)   )r8   r  r:   r  rb   r  r   r#   r   r   r<   r)   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r/   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r)   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r/   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r%   )NNN)r8   r  r:   r  rb   r  r   r#   r   r  r   r  r   r   r<   r%   )Dr7   r.   r8   r9   r:   r9   r   r   r   r   r   r/   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r_   r   r   r   r   r   r   r]  r   r^  r_   r   r0   r   r   r`  ra  r   r   r  r   r  r   r   r2   r   r2   r   r   r   r   r   r   r   r   r   r   r   r   r<   r,   )r8   r  r:   r  rb   r  r   r#   r   r   r<   r,   )Z
__future__r   r1  r  collections.abcr   r   r   typingr   r   r	   r
   r   r   numpyrl   pandasr   xarray.core.alignmentr   xarray.core.concatr   xarray.plot.facetgridr   xarray.plot.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   matplotlib.axesr#   matplotlib.collectionsr$   r%   matplotlib.colorsr&   r'   matplotlib.containerr(   matplotlib.contourr)   matplotlib.imager*   mpl_toolkits.mplot3d.art3dr+   r,   numpy.typingr-   xarray.core.dataarrayr.   xarray.core.typesr/   r0   r1   r2   r3   r4   r6   __annotations__rX   r~   r   r   r   r   r6  rH  r  r  re  rc  r  r   rd  r   rY   rW   <module>r     su   " " " " " " "      > > > > > > > > > > H H H H H H H H H H H H H H H H         + + + + + + % % % % % % 1 1 1 1 1 1                                         ,  0$$$$$$????????55555555111111111111******CCCCCCCC&&&&&&//////              0///// #%    Q( Q( Q( Q(n !%	D D D D DV  )-X& X& X& X& X& X&v 
 &* !!##!!+     
6 

  &* !!##!!+     
6 
  &* !!##!!+     
@  &* !!##!!+N N N N N Nb 
 ,1 
 
 
 
 
 

 
 ,1 
 
 
 
 
 

 
 ,1 
 
 
 
 
 

  ,1 ;P ;P ;P ;P ;P ;PB '+ !!##!!J J J J J JZ_ _ _D8 8 8 8< 
 !%"&!%&*!!" $(,)-##!!"&! #G& & & & & 
&R 
 !%"&!%&*!!" $(,)-##!!"&! #G& & & & & 
&R 
 !%"&!%&*!!" $(,)-##!!"&! #G& & & & & 
&R 	
 )-	        	 F@ @ @F 
 %
 '+!! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 	\ \ \ 	\~ 
 %
 '+!! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 		 	 	 		 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 		 	 	 		 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 	 #'"&< < < < 	<~ 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 
 %
 '+ !! $"& #%))-)-##!!!E% % % % % 
%P 		 	 	 		 	 	rY   