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

Fix static typing with Matplotlib 3.8 #8030

Merged
merged 25 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fd2c467
fix several typing issues with mpl3.8
headtr1ck Jul 29, 2023
a97d634
Merge branch 'main' into pr/8030
Illviljan Aug 3, 2023
63409a5
Merge branch 'main' into mpltypes
headtr1ck Sep 5, 2023
3b62890
fix scatter plot typing and remove funky pyplot import
headtr1ck Sep 5, 2023
7b44b1b
fix some more typing errors
headtr1ck Sep 5, 2023
9051f30
fix some import errors
headtr1ck Sep 7, 2023
55a63b6
undo some typing errors
headtr1ck Sep 7, 2023
9e2c352
fix xylim typing
headtr1ck Sep 7, 2023
42d3356
add forgotten import
headtr1ck Sep 11, 2023
b5d2249
ignore plotting overloads because None is Hashable
headtr1ck Sep 11, 2023
d1cc216
add whats-new entry
headtr1ck Sep 11, 2023
428a1ed
fix return type of hist
headtr1ck Sep 11, 2023
2ab1402
fix another xylim type
headtr1ck Sep 11, 2023
db0db64
fix some more xylim types
headtr1ck Sep 11, 2023
3809152
Merge branch 'main' into mpltypes
headtr1ck Sep 11, 2023
8897ba1
change to T_DataArray
headtr1ck Sep 12, 2023
c318096
Merge branch 'main' into mpltypes
headtr1ck Sep 12, 2023
64c2401
change accessor xylim to tuple
headtr1ck Sep 12, 2023
79a92f5
add missing return types
headtr1ck Sep 12, 2023
b9dcc6a
fix a typing error only on new mpl
headtr1ck Sep 12, 2023
1eef361
add unused-ignore to error codes for old mpl
headtr1ck Sep 12, 2023
f7246fe
add more unused-ignore to error codes for old mpl
headtr1ck Sep 12, 2023
33c6f20
replace type: ignore[attr-defined] with assert hasattr
headtr1ck Sep 12, 2023
06e4337
Merge branch 'main' into mpltypes
headtr1ck Sep 16, 2023
b1d721c
apply code review suggestions
headtr1ck Sep 16, 2023
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
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Breaking changes
extracts and add the indexes from another :py:class:`Coordinates` object
passed via ``coords`` (:pull:`8107`).
By `Benoît Bovy <https://github.com/benbovy>`_.
- Static typing of ``xlim`` and ``ylim`` arguments in plotting functions now must
be ``tuple[float, float]`` to align with matplotlib requirements. (:issue:`7802`, :pull:`8030`).
By `Michael Niklas <https://github.com/headtr1ck>`_.

Deprecations
~~~~~~~~~~~~
Expand Down
10 changes: 4 additions & 6 deletions xarray/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
from xarray.core.utils import FrozenDict

if TYPE_CHECKING:
try:
from matplotlib.colors import Colormap
except ImportError:
Colormap = str
from matplotlib.colors import Colormap

Options = Literal[
"arithmetic_join",
"cmap_divergent",
Expand Down Expand Up @@ -164,11 +162,11 @@ class set_options:
cmap_divergent : str or matplotlib.colors.Colormap, default: "RdBu_r"
Colormap to use for divergent data plots. If string, must be
matplotlib built-in colormap. Can also be a Colormap object
(e.g. mpl.cm.magma)
(e.g. mpl.colormaps["magma"])
cmap_sequential : str or matplotlib.colors.Colormap, default: "viridis"
Colormap to use for nondivergent data plots. If string, must be
matplotlib built-in colormap. Can also be a Colormap object
(e.g. mpl.cm.magma)
(e.g. mpl.colormaps["magma"])
display_expand_attrs : {"default", True, False}
Whether to expand the attributes section for display of
``DataArray`` or ``Dataset`` objects. Can be
Expand Down
Loading
Loading