Repository navigation
Multivar colorbar - #32607
Draft
trygvrad wants to merge 3 commits into
Draft
Multivar colorbar#32607trygvrad wants to merge 3 commits into
trygvrad wants to merge 3 commits into
Conversation
- Colorizer: an existing MultiNorm passed as *norm* is used as is instead of being wrapped in a new MultiNorm, which raised a ValueError. - MultiNorm.autoscale_None only emits the 'changed' signal when the limits of a constituent norm actually changed. - Colorbar.remove no longer fails when the mappable has no Axes. Changes implemented with the assistance of AI and manually evaluated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `Figure.colorbar_bivar` and `pyplot.colorbar_bivar`, which draw the colorbar of a bivariate colormap as a 2D image, with one data variable along each axis. The new `BivarColorbar` class lives in the new module `matplotlib.colorbar_multivariate`. Its Axes is created by the existing `colorbar.make_axes` / `colorbar.make_axes_gridspec`, so it takes part in layout (including constrained layout) like a regular colorbar, and `colorbar.py` itself is not changed. Changes implemented with the assistance of AI and manually evaluated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `Figure.colorbar_multivar` and `pyplot.colorbar_multivar`, which draw one regular colorbar per variable of a multivariate colormap. The colorbars can be arranged in several rows or columns with *n_major*. `MultivarColorbar` is a sequence of `Colorbar` objects and lives in `matplotlib.colorbar_multivariate`. `make_multivar_axes` takes the space for all colorbars from the parent Axes through `colorbar.make_axes`, as for a single colorbar, and splits it into one Axes per variable. Constrained layout is not supported yet and raises a NotImplementedError, unless the Axes for the colorbars are passed in explicitly. Changes implemented with the assistance of AI and manually evaluated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
Draft
This branch has not been deployed
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.
This PR has a long history. It is part of Bivariate and Multivariate Colormapping and contains changes that were previously part of #31214 which is being separated into multiple parts with the use of AI. This is part 3 of 4 and Depends on #32605 and #32606. Only the last commit ("Add multivariate colorbars") is new in this PR.
PR summary
Figure.colorbar_multivar/SubFigure.colorbar_multivarandpyplot.colorbar_multivar.MultivarColorbar(inmatplotlib.colorbar_multivariate) is a Sequence of ordinary Colorbar objects, one per variable, as jklymak suggested in Multivar colorbar #31214.make_multivar_axestakes the space for the whole block through the existingcolorbar.make_axes(as for a single colorbar), then splits it into one Axes per variable.Colorbars can also be drawn into user-supplied Axes with
caxes=.doc/release/next_whats_new/colorbar_multivar.rst.NOTE:
NotImplementedErrorunless caxes is given. Support follows in part 4, kept separate so the layout-engine changes can be reviewed on their own.There is no example in the docs yet, that will come in a separate PR.
Here is an example:
AI Disclosure
The split of #31214 into smaller PRs, and the changes requested in review there, were
made with the assistance of an AI coding assistant (Claude). All changes were reviewed
and tested by me.
PR quality check