From 0151c05eaadf3fe3cc5f7064f0e380293c3a0f23 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 28 Feb 2017 15:24:50 +0000 Subject: [PATCH] Make ginput dostring into a numpydocstring Small fixes Add default value for npoints Suggested changes to ginput docstring Better description of ginput return Put summary line by itself at the top Add in missing full stops --- lib/matplotlib/figure.py | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index f6184fd2cfcb..521e3fe603a2 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1827,17 +1827,10 @@ def subplots_adjust(self, *args, **kwargs): def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, mouse_pop=3, mouse_stop=2): """ - Blocking call to interact with the figure. - - This will wait for *n* clicks from the user and return a list of the - coordinates of each click. - - If *timeout* is zero or negative, does not timeout. + Blocking call to interact with a figure. - If *n* is zero or negative, accumulate clicks until a middle click - (or potentially both mouse buttons at once) terminates the input. - - Right clicking cancels last input. + Wait until the user clicks *n* times on the figure, and return the + coordinates of each click in a list. The buttons used for the various actions (adding points, removing points, terminating the inputs) can be overriden via the @@ -1845,6 +1838,30 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, the associated mouse button: 1 for left, 2 for middle, 3 for right. + Parameters + ---------- + n : int, optional, default: 1 + Number of mouse clicks to accumulate. If negative, accumulate + clicks until the input is terminated manually. + timeout : scalar, optional, default: 30 + Number of seconds to wait before timing out. If zero or negative + will never timeout. + show_clicks : bool, optional, default: False + If True, show a red cross at the location of each click. + mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click) + Mouse button used to add points. + mouse_pop : int, one of (1, 2, 3), optional, default: 3 (right click) + Mouse button used to remove the most recently added point. + mouse_stop : int, one of (1, 2, 3), optional, default: 2 (middle click) + Mouse button used to stop input. + + Returns + ------- + points : list of tuples + A list of the clicked (x, y) coordinates. + + 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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy