Update to docs with regards to colorbar and colorizer#30112
Update to docs with regards to colorbar and colorizer#30112timhoffm merged 3 commits intomatplotlib:mainfrom
Conversation
| 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.
|
Thank you @timhoffm, all the suggestions should be addressed now :) |
d56d471 to
150165b
Compare
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.Colorizerandcolorizer.ColorizingArtist(#28658).It also updates the docs of
colorbar.Colorbarto referencecolorizer.ColorizingArtistinstead ofcm.ScalarMappableSee #30008 for a related discussion.
PR checklist