matplotlib 3.5.1

AttributesBackRef

Attributes

mouseevent : `MouseEvent`

The mouse event that generated the pick.

artist : `matplotlib.artist.Artist`

The picked artist. Note that artists are not pickable by default (see .Artist.set_picker ).

other :

Additional attributes may be present depending on the type of the picked object; e.g., a .Line2D pick may define different extra attributes than a .PatchCollection pick.

This event is fired when the user picks a location on the canvas sufficiently close to an artist that has been made pickable with .Artist.set_picker .

A PickEvent has a number of special attributes in addition to those defined by the parent Event class.

A pick event.

Examples

ax.plot(np.rand(100), 'o', picker=5) # 5 points tolerance

def on_pick(event):

line = event.artist xdata, ydata = line.get_data() ind = event.ind print('on pick line:', np.array([xdata[ind], ydata[ind]]).T)

cid = fig.canvas.mpl_connect('pick_event', on_pick)

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.backend_bases.FigureCanvasBase.pick_event

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/backend_bases.py#1436
type: <class 'type'>
Commit: