fix(plot): use matplotlib colormaps registry instead of removed cm.get_cmap - #623
Open
catplotlib wants to merge 1 commit into
Open
fix(plot): use matplotlib colormaps registry instead of removed cm.get_cmap#623catplotlib wants to merge 1 commit into
catplotlib wants to merge 1 commit into
Conversation
…t_cmap matplotlib.cm.get_cmap was deprecated in matplotlib 3.7 and removed in 3.9, so both call sites raised AttributeError on any current matplotlib: - Robot.linkcolormap(name) for any named colormap - DistanceTransformPlanner.plan(animate=True), which failed before computing the distance map Both paths were unreachable from the test suite (one behind pragma nocover, one animate-only), so the earlier migration of PlannerBase.py to mpl.colormaps missed them. Use the colormaps registry, with resampled(6) replacing the old lut argument, and fold set_bad/set_over into with_extremes to avoid their PendingDeprecationWarning. Add regression tests covering both paths.
catplotlib
force-pushed
the
matplotlib-get-cmap-removal
branch
from
August 22, 2026 05:46
c63677c to
8335441
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
matplotlib.cm.get_cmapwas deprecated in matplotlib 3.7 and removed in 3.9. Two call sites still used it, so both raisedAttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'on any current matplotlib (matplotlibis unpinned inpyproject.toml):RobotPlottingMPL.linkcolormap(name)for any named colormap - a public API whose own docstringrunblockcallsrobot.linkcolormap("inferno")DistanceTransformPlanner.plan(animate=True), which failed before computing the distance mapBoth are switched to the
colormapsregistry, withresampled(6)replacing the oldlutargument.set_bad/set_overin the revived animate path are folded intowith_extremesso executing it does not introduce newPendingDeprecationWarnings.Neither path was reachable from the test suite - one sat behind
# pragma: nocover, the other only runs underanimate=True- which is why the earlier migration ofPlannerBase.pytompl.colormapsmissed them. Those two now-covered pragmas are dropped.Related issue
None - found while checking an unrelated colorbar report, not tied to an existing issue.
Checklist
type: description) — checked automatically, see the "Check PR title" statuspytest) — 632 passed, 72 skipped. The 4test_bin.pyfailures also occur on pristinemainhere (missingipythonextra) and are unrelated.AttributeErrorabove.X | Y,list[X], notUnion/Optional/List) — no signatures added or changed.:param:,:returns:; type hints in the signature cover types now,:type:/:rtype:are rarely needed) — no public API change.