Visitar URL original
Matplotlib v3.9 compatibility by C-Achard · Pull Request #3394 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9cc1d18
Add Matplotlib colormap compatibility shim
C-Achard Jul 13, 2026
9518b9d
Allow custom warning stacklevel in deprecated
C-Achard Jul 13, 2026
bd7fdbb
Use shared get_colormap helper everywhere
C-Achard Jul 13, 2026
4bf4921
Merge branch 'main' into cy/init-mpl-version-change
C-Achard Jul 16, 2026
a5d5221
Merge remote-tracking branch 'upstream/main' into cy/init-mpl-version…
deruyter92 Aug 9, 2026
d5945cc
Fix get_colormap_names() legacy fallback to call _legacy_get_colormap…
deruyter92 Aug 9, 2026
d77d4f8
update version for "deprecated since .." warning
deruyter92 Aug 9, 2026
5e739e2
Add name override to deprecated() for legacy shim warnings
deruyter92 Aug 9, 2026
e6cfac6
Rename matplotlib_future_mode.py → matplotlib_compat.py
deruyter92 Aug 9, 2026
d9288fc
add tests for matplotlib compat layer
deruyter92 Aug 9, 2026
350e209
Import matplotlib.cm explicitly in the compat layer
C-Achard Sep 4, 2026
54ac2ac
Prevent duplicate legacy colormap registration
C-Achard Sep 4, 2026
b1c97fb
Route all plt.get_cmap calls throught the compat layer
C-Achard Sep 4, 2026
c1cf140
Use compat helper to clear matplotlib artists
C-Achard Sep 4, 2026
0e4a691
Patch matplotlib's Axes logger by name
C-Achard Sep 4, 2026
d3472c3
Test the name and stacklevel options of @deprecated
C-Achard Sep 4, 2026
0be8837
Expand matplotlib compat test coverage
C-Achard Sep 4, 2026
fe9d488
Remove unused compat helpers
C-Achard Sep 4, 2026
304bcc6
Remove unecessary tests
C-Achard Sep 4, 2026
aa007f6
Rename matplotlib compat module to utils
C-Achard Sep 4, 2026
0584d53
Replace matplotlib_compat colormap helpers
C-Achard Sep 4, 2026
1c15225
Simplify Matplotlib axes logger helper
C-Achard Sep 4, 2026
8a0ea71
Fix Matplotlib artist iteration
C-Achard Sep 4, 2026
426943f
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 8, 2026
31380eb
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 8, 2026
de29151
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 9, 2026
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
Prev Previous commit
Next Next commit
Simplify Matplotlib axes logger helper
This change trims the helper and tests down to the essential behavior: the axes logger is still retrieved by name and its level is set, while the extra explanatory comments and redundant explicit-level test are removed. The result is a smaller, clearer implementation without changing the intended logger suppression behavior.
  • Loading branch information
C-Achard committed Sep 4, 2026
commit 1c15225d203a02c065afcc48c95989fa4af80bd3
11 changes: 0 additions & 11 deletions deeplabcut/utils/matplotlib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
#
# Licensed under GNU Lesser General Public License v3.0
#
"""Small Matplotlib helpers shared across DeepLabCut."""

from __future__ import annotations

import logging

# Matplotlib builds this logger with ``logging.getLogger(__name__)`` in
# ``matplotlib/axes/_axes.py``, so the name is enough to reach it.
AXES_LOGGER_NAME = "matplotlib.axes._axes"


Expand All @@ -25,13 +21,6 @@ def silence_axes_logger(level: int | str = "ERROR") -> None:
Suppresses the chatty per-artist messages Matplotlib emits while drawing,
most notably the invalid-color warnings raised during 3D plotting.

Reaches the logger by name rather than importing ``_log`` from the private
``matplotlib.axes._axes`` module. This is the same logger object, not a
parallel one: Matplotlib creates it with ``logging.getLogger(__name__)``,
and the logging manager returns that same instance here -- or, if this runs
first, hands Matplotlib the instance created here. Import order therefore
does not matter.

Args:
level: Any level accepted by ``logging.Logger.setLevel``.
"""
Expand Down
7 changes: 0 additions & 7 deletions tests/utils/test_matplotlib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

@pytest.fixture
def axes_logger():
"""Yield Matplotlib's Axes logger, restoring its level afterwards."""
logger = logging.getLogger(mu.AXES_LOGGER_NAME)
original = logger.level
yield logger
Expand All @@ -48,9 +47,3 @@ def test_silence_axes_logger_sets_the_level(axes_logger):
mu.silence_axes_logger()

assert axes_logger.level == logging.ERROR


def test_silence_axes_logger_accepts_an_explicit_level(axes_logger):
mu.silence_axes_logger(logging.CRITICAL)

assert axes_logger.level == logging.CRITICAL