matplotlib 3.5.1

NotesParametersReturnsBackRef
ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=<MouseButton.LEFT: 1>, mouse_pop=<MouseButton.RIGHT: 3>, mouse_stop=<MouseButton.MIDDLE: 2>)

Wait until the user clicks n times on the figure, and return the coordinates of each click in a list.

There are three possible interactions:

The actions are assigned to mouse buttons via the arguments mouse_add, mouse_pop and mouse_stop.

Notes

The keyboard can also be used to select points in case your mouse does not have one or more of the buttons. The delete and backspace keys act like right clicking (i.e., remove last point), the enter key terminates input and any other key (not already used by the window manager) selects a point.

Parameters

n : int, default: 1

Number of mouse clicks to accumulate. If negative, accumulate clicks until the input is terminated manually.

timeout : float, default: 30 seconds

Number of seconds to wait before timing out. If zero or negative will never timeout.

show_clicks : bool, default: True

If True, show a red cross at the location of each click.

mouse_add : `.MouseButton` or None, default: `.MouseButton.LEFT`

Mouse button used to add points.

mouse_pop : `.MouseButton` or None, default: `.MouseButton.RIGHT`

Mouse button used to remove the most recently added point.

mouse_stop : `.MouseButton` or None, default: `.MouseButton.MIDDLE`

Mouse button used to stop input.

Returns

list of tuples

A list of the clicked (x, y) coordinates.

Blocking call to interact with a figure.

Examples

See :

Back References

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

matplotlib._blocking_input.blocking_input_loop matplotlib.backend_bases.FigureCanvasBase.start_event_loop

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/figure.py#3021
type: <class 'function'>
Commit: