Skip to content

Fix gallery colormaps across renderers [mpl compatibility] - #245

Closed
sselvakumaran wants to merge 5 commits into
mainfrom
agent/mpl-colormap-gallery-compat
Closed

Fix gallery colormaps across renderers [mpl compatibility]#245
sselvakumaran wants to merge 5 commits into
mainfrom
agent/mpl-colormap-gallery-compat

Conversation

@sselvakumaran

Copy link
Copy Markdown
Contributor

What changed

  • add Matplotlib-compatible Reds, bone, autumn, and BuPu colormaps
  • keep the Python channel, pyplot, SVG/raster, and browser registries in sync
  • make generic _r lookup work across pyplot's colormap namespace
  • add cross-renderer and reversal tests so an unknown name cannot silently fall back to viridis

Why

These are required by the in-scope Matplotlib 3.11 gallery examples. Before this change, colorbar_basics.py stops before drawing its Reds_r image because the colormap is absent.

Official reference: https://matplotlib.org/stable/gallery/color/colorbar_basics.html

Before, Matplotlib reference, and colormap-only after

The after panel is intentionally a partial execution. It proves the Reds_r registry/rendering fix, then stops at the next independent compatibility gap: colorbar(location=..., anchor=..., shrink=...). A separate dependent PR handles those colorbar options.

Gallery impact

  • misc/table_demo.py now executes through its previous missing-BuPu blocker, but its table layout is still not visually Matplotlib-compatible, so this PR does not claim it as visually complete.
  • colorbar_basics.py, contourf_demo.py, and plot_streamplot.py advance to their next independent API blockers.
  • Net execution-paired delta from this isolated PR: +1. Net visually accepted delta: 0 until the downstream layout/API fixes land.

Validation

  • 570 passed, 65 skipped across pyplot and SVG export suites
  • Ruff check and format
  • JavaScript typecheck and build
  • exact adapted Matplotlib gallery smoke renders across native/static paths

@codspeed-hq

codspeed-hq Bot commented Jul 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 103 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing agent/mpl-colormap-gallery-compat (7aad1eb) with main (989a3a7)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on main (bf903bc) during the generation of this report, so 989a3a7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@sselvakumaran

sselvakumaran commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

<NEVERMIND, FIXED IN ANOTHER PR>

second colormap (with blues and reds) is still empty.

reds looks good. the second plot with just red does not have the gradient colormap legend like the first one and should be fixed. (note the matplotlib one has the legends looking different, one is smaller than the other!)
also there is no legend for the right-most combined one, but i assume that one hasn’t been rendered at all. note the legend looks different here too.

@sselvakumaran sselvakumaran changed the title Add Matplotlib gallery colormaps across renderers Fix gallery colormaps across renderers [mpl compatibility] Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f54be9b3-aa35-4622-86c2-49a1b2c1dc8b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/mpl-colormap-gallery-compat

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant