matplotlib 3.5.1

AttributesBackRef

Attributes

button : None or `MouseButton` or {'up', 'down'}

The button pressed. 'up' and 'down' are used for scroll events. Note that LEFT and RIGHT actually refer to the "primary" and "secondary" buttons, i.e. if the user inverts their left and right buttons ("left-handed setting") then the LEFT button will be the one physically on the right.

key : None or str

The key pressed when the mouse event triggered, e.g. 'shift'. See KeyEvent .

warning

This key is currently obtained from the last 'key_press_event' or 'key_release_event' that occurred within the canvas. Thus, if the last change of keyboard state occurred while the canvas did not have focus, this attribute will be wrong.

step : float

The number of scroll steps (positive for 'up', negative for 'down'). This applies only to 'scroll_event' and defaults to 0 otherwise.

dblclick : bool

Whether the event is a double-click. This applies only to 'button_press_event' and is False otherwise. In particular, it's not used in 'button_release_event'.

A MouseEvent has a number of special attributes in addition to those defined by the parent Event and LocationEvent classes.

A mouse event ('button_press_event', 'button_release_event', 'scroll_event', 'motion_notify_event').

Examples

def on_press(event):

print('you pressed', event.button, event.xdata, event.ydata)

cid = fig.canvas.mpl_connect('button_press_event', on_press)

See :

Back References

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

matplotlib.backend_bases.FigureCanvasBase.scroll_event matplotlib.backend_bases.FigureCanvasBase.button_release_event matplotlib.backend_bases.FigureCanvasBase.button_press_event matplotlib.backend_bases matplotlib.backend_bases.FigureCanvasBase.mpl_connect matplotlib.backend_bases.FigureCanvasBase.motion_notify_event matplotlib.pyplot.connect matplotlib.backend_bases.button_press_handler matplotlib.widgets.EllipseSelector matplotlib.widgets.RectangleSelector

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#1370
type: <class 'type'>
Commit: