The user can select points on a plot with the ginput
function or select the position at which to place text on the plot with the gtext
function using the mouse.
Return the position and type of mouse button clicks and/or key strokes in the current figure window.
If n is defined, then capture n events before returning. When n is not defined ginput
will loop until the return key RET is pressed.
The return values x, y are the coordinates where the mouse was clicked in the units of the current axes. The return value button is 1, 2, or 3 for the left, middle, or right button. If a key is pressed the ASCII value is returned in button.
Implementation Note: ginput
is intenteded for 2-D plots. For 3-D plots see the currentpoint property of the current axes which can be transformed with knowledge of the current view
into data units.
See also: gtext, waitforbuttonpress.
Place text on the current figure using the mouse.
The text is defined by the string s. If s is a cell string organized as a row vector then each string of the cell array is written to a separate line. If s is organized as a column vector then one string element of the cell array is placed for every mouse click.
Optional property/value pairs are passed directly to the underlying text objects.
The optional return value h is a graphics handle to the created text object(s).
More sophisticated user interaction mechanisms can be obtained using the ui* family of functions, see UI Elements.
© 1996–2018 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/interpreter/Interacting-with-Plots.html