Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update to docs with regards to colorbar and colorizer#30112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 3 commits intomatplotlib:mainfromtrygvrad:colorbar-docs-colorizer
Jun 2, 2025

Conversation

trygvrad
Copy link
Contributor

@trygvradtrygvrad commentedMay 26, 2025
edited
Loading

PR summary

This PR updateshttps://matplotlib.org/stable/gallery/images_contours_and_fields/multi_image.html andhttps://matplotlib.org/stable/users/explain/colors/colorbar_only.html in light of the interoduction ofcolorizer.Colorizer andcolorizer.ColorizingArtist (#28658).

It also updates the docs ofcolorbar.Colorbar to referencecolorizer.ColorizingArtist instead ofcm.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
Member

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.

Copy link
ContributorAuthor

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` whichcontains a `matplotlib.colorizer.Colorizer` that holds the data-to-color pipeline(norm and colormap). To create a colorbar without an attached plot one canuse a `.ColorizingArtist` with no associated data."""

(and should we remove the last sentence?)

Copy link
Member

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.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done :)

@trygvrad
Copy link
ContributorAuthor

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

@trygvradtrygvradforce-pushed thecolorbar-docs-colorizer branch fromd56d471 to150165bCompareJune 2, 2025 20:24
@timhoffmtimhoffm added this to thev3.11.0 milestoneJun 2, 2025
@timhoffmtimhoffm merged commitb09a0c7 intomatplotlib:mainJun 2, 2025
39 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
Documentation: examplesfiles in galleries/examplesDocumentation: user guidefiles in galleries/users_explain or doc/userstopic: color/color & colormapstopic: figures and subfigures
Projects
None yet
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

2 participants
@trygvrad@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp