From fcad6ded798b2aacbff93ae5288a9e8291f3cf9a Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Fri, 22 Mar 2024 07:25:48 +0100 Subject: [PATCH] Update utils.py --- xarray/plot/utils.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/xarray/plot/utils.py b/xarray/plot/utils.py index 0c286929809..7422db4c5d2 100644 --- a/xarray/plot/utils.py +++ b/xarray/plot/utils.py @@ -30,7 +30,7 @@ from matplotlib.collections import LineCollection from matplotlib.colors import Colormap, Normalize from matplotlib.ticker import FuncFormatter - from matplotlib.typing import ColorType, LineStyleType + from matplotlib.typing import ColorType, DrawStyleType, LineStyleType from mpl_toolkits.mplot3d.art3d import Line3DCollection from numpy.typing import ArrayLike @@ -1294,14 +1294,16 @@ def _infer_meta_data(ds, x, y, hue, hue_style, add_guide, funcname): def _parse_size( data: None, norm: tuple[float | None, float | None, bool] | Normalize | None, -) -> None: ... +) -> None: + ... @overload def _parse_size( data: DataArray, norm: tuple[float | None, float | None, bool] | Normalize | None, -) -> pd.Series: ... +) -> pd.Series: + ... # copied from seaborn @@ -1446,10 +1448,12 @@ def data_is_numeric(self) -> bool: return self._data_is_numeric @overload - def _calc_widths(self, y: np.ndarray) -> np.ndarray: ... + def _calc_widths(self, y: np.ndarray) -> np.ndarray: + ... @overload - def _calc_widths(self, y: DataArray) -> DataArray: ... + def _calc_widths(self, y: DataArray) -> DataArray: + ... def _calc_widths(self, y: np.ndarray | DataArray) -> np.ndarray | DataArray: """ @@ -1471,10 +1475,12 @@ def _calc_widths(self, y: np.ndarray | DataArray) -> np.ndarray | DataArray: return widths @overload - def _indexes_centered(self, x: np.ndarray) -> np.ndarray: ... + def _indexes_centered(self, x: np.ndarray) -> np.ndarray: + ... @overload - def _indexes_centered(self, x: DataArray) -> DataArray: ... + def _indexes_centered(self, x: DataArray) -> DataArray: + ... def _indexes_centered(self, x: np.ndarray | DataArray) -> np.ndarray | DataArray: """ @@ -1846,7 +1852,8 @@ def _line( plotnonfinite: bool = ..., data=..., **kwargs, -) -> LineCollection: ... +) -> LineCollection: + ... @overload @@ -1868,8 +1875,10 @@ def _line( edgecolors: Literal["face", "none"] | ColorType | Sequence[ColorType] | None = ..., plotnonfinite: bool = ..., data=..., + drawstyle: DrawStyleType = ..., **kwargs, -) -> Line3DCollection: ... +) -> Line3DCollection: + ... def _line( @@ -1890,6 +1899,7 @@ def _line( edgecolors: Literal["face", "none"] | ColorType | Sequence[ColorType] | None = None, plotnonfinite: bool = False, data=None, + drawstyle: DrawStyleType = "default", **kwargs, ) -> LineCollection | Line3DCollection: """ @@ -2021,7 +2031,6 @@ def _parse_lines_color_args( if linestyle is None: linestyle = rcParams["lines.linestyle"] - drawstyle = kwargs.pop("drawstyle", "default") if drawstyle == "default": # Draw linear lines: xyz = list(v for v in (x_, y_, z) if v is not None)