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.
The key pressed when the mouse event triggered, e.g. 'shift'. See KeyEvent
.
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.
The number of scroll steps (positive for 'up', negative for 'down'). This applies only to 'scroll_event' and defaults to 0 otherwise.
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').
def on_press(event):
print('you pressed', event.button, event.xdata, event.ydata)
See :cid = fig.canvas.mpl_connect('button_press_event', on_press)
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
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