Skip to content

Commit 9154be9

Browse files
authored
Merge pull request #8172 from dstansby/ginput-docstring
[DOC] Turn ginput dostring into a numpydocstring
2 parents 6ccb900 + 463b3fd commit 9154be9

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

lib/matplotlib/figure.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,24 +1827,41 @@ def subplots_adjust(self, *args, **kwargs):
18271827
def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1,
18281828
mouse_pop=3, mouse_stop=2):
18291829
"""
1830-
Blocking call to interact with the figure.
1831-
1832-
This will wait for *n* clicks from the user and return a list of the
1833-
coordinates of each click.
1834-
1835-
If *timeout* is zero or negative, does not timeout.
1830+
Blocking call to interact with a figure.
18361831
1837-
If *n* is zero or negative, accumulate clicks until a middle click
1838-
(or potentially both mouse buttons at once) terminates the input.
1839-
1840-
Right clicking cancels last input.
1832+
Wait until the user clicks *n* times on the figure, and return the
1833+
coordinates of each click in a list.
18411834
18421835
The buttons used for the various actions (adding points, removing
18431836
points, terminating the inputs) can be overriden via the
18441837
arguments *mouse_add*, *mouse_pop* and *mouse_stop*, that give
18451838
the associated mouse button: 1 for left, 2 for middle, 3 for
18461839
right.
18471840
1841+
Parameters
1842+
----------
1843+
n : int, optional, default: 1
1844+
Number of mouse clicks to accumulate. If negative, accumulate
1845+
clicks until the input is terminated manually.
1846+
timeout : scalar, optional, default: 30
1847+
Number of seconds to wait before timing out. If zero or negative
1848+
will never timeout.
1849+
show_clicks : bool, optional, default: False
1850+
If True, show a red cross at the location of each click.
1851+
mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click)
1852+
Mouse button used to add points.
1853+
mouse_pop : int, one of (1, 2, 3), optional, default: 3 (right click)
1854+
Mouse button used to remove the most recently added point.
1855+
mouse_stop : int, one of (1, 2, 3), optional, default: 2 (middle click)
1856+
Mouse button used to stop input.
1857+
1858+
Returns
1859+
-------
1860+
points : list of tuples
1861+
A list of the clicked (x, y) coordinates.
1862+
1863+
Notes
1864+
-----
18481865
The keyboard can also be used to select points in case your mouse
18491866
does not have one or more of the buttons. The delete and backspace
18501867
keys act like right clicking (i.e., remove last point), the enter key

0 commit comments

Comments
 (0)