matplotlib.pyplot.connect(s, func)
[source]
Connect event with string s to func. The signature of func is:
def func(event)
where event is a matplotlib.backend_bases.Event
. The following events are recognized
For the location events (button and key press/release), if the mouse is over the axes, the variable event.inaxes
will be set to the Axes
the event occurs is over, and additionally, the variables event.xdata
and event.ydata
will be defined. This is the mouse location in data coords. See KeyEvent
and MouseEvent
for more info.
Return value is a connection id that can be used with mpl_disconnect()
.
Usage:
def on_press(event): print('you pressed', event.button, event.xdata, event.ydata) cid = canvas.mpl_connect('button_press_event', on_press)
matplotlib.pyplot.connect
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.connect.html