GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update to docs with regards to colorbar and colorizer by trygvrad · Pull Request #30112 · matplotlib/matplotlib

Conversation

@trygvrad

@trygvrad trygvrad commented May 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR summary

This PR updates https://matplotlib.org/stable/gallery/images_contours_and_fields/multi_image.html and https://matplotlib.org/stable/users/explain/colors/colorbar_only.html in light of the interoduction of colorizer.Colorizer and colorizer.ColorizingArtist (#28658).

It also updates the docs of colorbar.Colorbar to reference colorizer.ColorizingArtist instead of cm.ScalarMappable

See #30008 for a related discussion.

PR checklist

  • [N/A] "closes #0000" is in the body of the PR description to link the related issue
  • [N/A] new and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New Features and API Changes are noted with a directive and release note
  • Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@trygvrad
Update to docs with regards to colorbar and colorizer
4af03f4
@github-actions github-actions Bot added topic: color/color & colormaps topic: figures and subfigures Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users labels May 26, 2025
@trygvrad trygvrad mentioned this pull request May 26, 2025
Update colorbar with new colorizer API #30008
Closed
2 of 3 tasks
timhoffm
timhoffm reviewed May 26, 2025
View reviewed changes
Comment thread galleries/examples/images_contours_and_fields/multi_image.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread galleries/examples/images_contours_and_fields/multi_image.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread galleries/examples/images_contours_and_fields/multi_image.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread galleries/users_explain/colors/colorbar_only.py Outdated
Comment on lines +11 to +15
A `~.Figure.colorbar` needs a "mappable" (`matplotlib.colorizer.ColorizingArtist`)
object (typically, an image) which contains a colorizer
(`matplotlib.colorizer.Colorizer`) that holds the data-to-color pipeline (norm and
colormap). In order to create a colorbar without an attached image, one can instead
use a `.ColorizingArtist` with no associated data.

@timhoffm timhoffm May 26, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can be more straightforward. ColorizingArtist is the base class for everything that "can be colormapped". Directly instruct to create the base class and pass it to colorbar. This the detour "typically subclasses with data, like image, but you can create without data" is not needed for the context of creating a standalone colorbar.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@trygvrad trygvrad Jun 1, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback, does the following read more easily:

"""
A `~.Figure.colorbar` requires a `matplotlib.colorizer.ColorizingArtist` which
contains a `matplotlib.colorizer.Colorizer` that holds the data-to-color pipeline
(norm and colormap). To create a colorbar without an attached plot one can 
use a `.ColorizingArtist` with no associated data.
"""

(and should we remove the last sentence?)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@timhoffm timhoffm Jun 2, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is okish. Maybe an improvement would be to switch the last sentence for

To create a colorbar without an attached plot one can directly instantiate the
base class .ColorizingArtist, which has no associated data.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@trygvrad trygvrad Jun 2, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@trygvrad
Updates based on code review
155ae8a
@trygvrad

trygvrad commented Jun 1, 2025

Copy link
Copy Markdown
Contributor Author

Thank you @timhoffm, all the suggestions should be addressed now :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm approved these changes Jun 2, 2025
View reviewed changes
@trygvrad
Tiny update from code review
150165b
@trygvrad
trygvrad force-pushed the colorbar-docs-colorizer branch from d56d471 to 150165b Compare June 2, 2025 20:24
@timhoffm timhoffm added this to the v3.11.0 milestone Jun 2, 2025
@timhoffm
timhoffm merged commit b09a0c7 into matplotlib:main Jun 2, 2025
@yashuatla yashuatla mentioned this pull request Jun 23, 2025
Feature implementation from commits 53355ca..9120862 yashuatla/matplotlib#3
Open
@QuLogic QuLogic added this to Bivariate and Multivariate Colormapping Aug 26, 2025
@QuLogic QuLogic moved this to Done in Bivariate and Multivariate Colormapping Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@timhoffm timhoffm timhoffm approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users topic: color/color & colormaps topic: figures and subfigures

Projects

Bivariate and Multivariate Colormapping
Status: Done

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@trygvrad @timhoffm
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.