ColorbarAxes is an imperfect proxy for the Axes passed to Colorbar · Issue #20479 · matplotlib/matplotlib · GitHub
Skip to content

ColorbarAxes is an imperfect proxy for the Axes passed to Colorbar #20479

Description

@richardsheridan

Bug report

Bug summary

Before the refactor, one would set colorbar axes to be pickable with colorbar.ax.set_picker(True). Now, it is necessary to use the undocumented colorbar.ax.inner_ax.set_picker(True). Likewise, with motion notify events, MouseEvent.inaxes is not colorbar.ax under any circumstances, it always is colorbar.ax.inner_ax.

But, this is not really about events so much as the fact that Colorbar(ax).ax is ax == False and all methods of colorbar.ax are actually bound to a different object, namely colorbar.ax.inner_ax, so they are acting on surprising, hidden state (from a user's perspective).

We could work around the events issue, but I feel like there would be an ongoing stream of bug reports without a comprehensive fix. On the other hand, I definitely don't want to revert ColorbarAxes entirely because I really like the improvements that it enabled.

Code for reproduction

Please see #20471, which this issue blocks (in my opinion).

Matplotlib version

  • Operating system: Win10
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): master
  • Matplotlib backend (print(matplotlib.get_backend())): tkagg
  • Python version: 3.8.8
  • Jupyter version (if applicable):
  • Other libraries:

cc @jklymak

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions