[Matplotlib-users] pick events don't work with twiny

V. Armando Solé sole at esrf.fr
Wed Jan 31 02:31:50 EST 2018


On 30/01/2018 17:27, Benjamin Root wrote:
> I seem to recall someone once messing around with the zorder of the
> axes object, but I forget if that actually worked. Of course the other
> workaround is to make the axes with the pickable objects be the twined
> axes.
>

I'm using something on those lines since some time that works for me
since quite some time. Here is a code fragment:

            self.ax = self.fig.add_axes([.15, .15, .75, .75], label="left")
            self.ax2 = self.ax.twinx()
            self.ax2.set_label("right")
            # critical for picking!!!!
            self.ax2.set_zorder(0)
            self.ax2.set_autoscaley_on(True)
            self.ax.set_zorder(1)
            self.fig.sca(self.ax)

Best regards,

Armando



More information about the Matplotlib-users mailing list