Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[mpl_toolkits] Things drawn on parasite axes don't fire pick events #5581

Closed
@smheidrich

Description

@smheidrich

Description

pick_events aren't fired for things that are drawn on parasite axes which were created using the twin* methods on mpl_toolkits.axes_grid1.host_subplot host axes.

How to reproduce

Code

from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
from numpy import arange, sin, pi

host_a = host_subplot(111)
para_a = host_a.twin()
# This works:
# a = host_a
# This doesn't:
a = para_a

t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
line, = a.plot(t, s, picker=5)

def onpick(event):
  print("picked")
plt.gcf().canvas.mpl_connect('pick_event', onpick)

plt.show()

Steps

  1. Click on the curve that is drawn.
  2. Check if "picked" was written to standard output.

It works fine if the curve is drawn to the host axes, but it doesn't work if it's drawn on the parasite axes instead.

Info

See also #5580 .

Matplotlib version: 6245d4e
Python version: Any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions