Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type annotation for center argument of dataaray_plot methods #8261

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading