Skip to content

Initial matplotlib compat layer - #3394

Draft
C-Achard wants to merge 4 commits into
mainfrom
cy/init-mpl-version-change
Draft

Initial matplotlib compat layer#3394
C-Achard wants to merge 4 commits into
mainfrom
cy/init-mpl-version-change

Conversation

@C-Achard

Copy link
Copy Markdown
Collaborator

Scope

Adds a small compatibility layer for matplotlib, to be extended, which allows to safely transition towards more recent version and release the pin.

  • Wraps deprecated matplotlib calls into compatibility shims
  • Warns about upcoming deprecation
  • Can be extended as required until all matplotlib call sites are fixed

C-Achard added 3 commits July 13, 2026 15:42
Introduce a new utility module that centralizes colormap access, listing, registration, and unregistration across Matplotlib API versions. The new helpers prefer modern `matplotlib.colormaps` APIs when available and fall back to legacy `matplotlib.cm`/`pyplot` behavior, with deprecation markers on legacy paths to support the migration.
Adds a `stacklevel` argument to `deeplabcut.core.deprecation.deprecated()` and uses it when emitting `DLCDeprecationWarning`. This keeps the default behavior (`stacklevel=2`) while allowing wrapper/legacy shim layers to bump the level so warnings point to the real caller.
Replaced direct `plt.cm.get_cmap(...)` calls across visualization and plotting modules with `deeplabcut.utils.matplotlib_future_mode.get_colormap`. This centralizes colormap access, keeps behavior consistent across TensorFlow/PyTorch/GUI/3D paths, and aligns with Matplotlib future-mode compatibility.
@C-Achard C-Achard self-assigned this Jul 13, 2026
@C-Achard C-Achard added enhancement New feature or request backwards compatibility issues concerning prior to current versions labels Jul 13, 2026
@C-Achard C-Achard added this to the Release matplotlib pin milestone Jul 13, 2026
@deruyter92 deruyter92 modified the milestones: Release matplotlib pin, Refresh/bump core dependencies Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatibility issues concerning prior to current versions enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants