Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Description
Describe the issue
A Colorbar currently stores the Axes that is used for drawing in thecbar.ax attribute, which many of the methods are then called internally likeself.ax.pcolormesh(). My proposal is to move the Axes up a level and have Colorbar inherit from the newCbarAxes class (to become an Axes itself) and turn the previous call intoself.pcolormesh() droppingax attribute.
Benefits: This would help with interactivity as proposed in#19515, by being able to identify if an axes is a Colorbar or not and then controlling properties based on that. It would also help with#20330, by giving the CbarAxes the ability to remove colorbar callbacks.
Drawbacks: This adds a lot of easy-to-use methods onto a Colorbar now that may not be desired to directly expose to users. i.e. they could docbar.plot() now, whereas beforecbar.ax.plot() hides those capabilities a little bit more.
Proposed fix
Define the class asclass ColorbarBase(ColorbarAxes):
and setself.ax = self for people to keep usingcbar.ax if they prefer. We could deprecate that on pass-through as well.
Seethis branch for an implementation.