FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update to docs with regards to colorbar and colorizer by trygvrad · Pull Request #30112 · matplotlib/matplotlib · GitHub

Repository navigation

Update to docs with regards to colorbar and colorizer - #30112

Merged
timhoffm merged 3 commits into
matplotlib:mainfrom
trygvrad:colorbar-docs-colorizer
Jun 2, 2025
Merged

timhoffm merged 3 commits into
matplotlib:mainfrom
trygvrad:colorbar-docs-colorizer

Conversation

trygvrad commented May 26, 2025 •
edited
Loading

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done :)

trygvrad commented Jun 1, 2025

Copy link
Copy Markdown
Contributor Author

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

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

Labels

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL