Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the docs, i.e. <code>help(ginput)</code>,</p> <blockquote> <p>ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, mouse_pop=3, mouse_stop=2)</p> <p>Blocking call to interact with the figure.</p> <p>This will wait for <em>n</em> clicks from the user and return a list of the coordinates of each click.</p> <p>If <em>timeout</em> is zero or negative, does not timeout.</p> <p>If <em>n</em> is zero or negative, accumulate clicks until a middle click (or potentially both mouse buttons at once) terminates the input.</p> <p>Right clicking cancels last input.</p> <p>The buttons used for the various actions (adding points, removing points, terminating the inputs) can be overriden via the arguments *mouse_add*, *mouse_pop* and *mouse_stop*, that give the associated mouse button: 1 for left, 2 for middle, 3 for right.</p> <p>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.</p> </blockquote> <p>We can <strong>set <code>n=0</code></strong> to have ginput wait for a mouse middle click instead of a set number of points. </p> <p>Bonus: setting <code>timeout=0</code> stops ginput from quitting after the default 30s. I find this annoying for complex plots.</p> <p>Example code:</p> <pre><code>import pylab x = randn(10,10) imshow(x) points = ginput(0, 0) # Select the points defining your region from the # plot then middle click to terminate ginput. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload