Skip to content

Commit

Permalink
Update type annotation for center argument of dataaray_plot methods (p…
Browse files Browse the repository at this point in the history
…ydata#8261)

* Update type annotation for center argument of dataaray_plot methods

* address review comments
  • Loading branch information
eendebakpt authored Oct 2, 2023
1 parent 26b5fe2 commit a1d168d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ Bug fixes
- Static typing of dunder ops methods (like :py:meth:`DataArray.__eq__`) has been fixed.
Remaining issues are upstream problems (:issue:`7780`, :pull:`8204`).
By `Michael Niklas <https://github.com/headtr1ck>`_.
- Fix type annotation for ``center`` argument of plotting methods (like :py:meth:`xarray.plot.dataarray_plot.pcolormesh`) (:pull:`8261`).
By `Pieter Eendebak <https://github.com/eendebakpt>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
34 changes: 17 additions & 17 deletions xarray/plot/dataarray_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ def _plot2d(plotfunc):
`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
center : float or False, 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.
Expand Down Expand Up @@ -1432,7 +1432,7 @@ def newplotfunc(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1692,7 +1692,7 @@ def imshow( # type: ignore[misc,unused-ignore] # None is hashable :(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1733,7 +1733,7 @@ def imshow(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1774,7 +1774,7 @@ def imshow(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1911,7 +1911,7 @@ def contour( # type: ignore[misc,unused-ignore] # None is hashable :(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1952,7 +1952,7 @@ def contour(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -1993,7 +1993,7 @@ def contour(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2047,7 +2047,7 @@ def contourf( # type: ignore[misc,unused-ignore] # None is hashable :(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2088,7 +2088,7 @@ def contourf(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2129,7 +2129,7 @@ def contourf(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2183,7 +2183,7 @@ def pcolormesh( # type: ignore[misc,unused-ignore] # None is hashable :(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2224,7 +2224,7 @@ def pcolormesh(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2265,7 +2265,7 @@ def pcolormesh(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2370,7 +2370,7 @@ def surface(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2411,7 +2411,7 @@ def surface(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down Expand Up @@ -2452,7 +2452,7 @@ def surface(
vmin: float | None = None,
vmax: float | None = None,
cmap: str | Colormap | None = None,
center: float | None = None,
center: float | Literal[False] | None = None,
robust: bool = False,
extend: ExtendOptions = None,
levels: ArrayLike | None = None,
Expand Down

0 comments on commit a1d168d

Please sign in to comment.