Next: Test Plotting Functions, Previous: Printing and Saving Plots, Up: High-Level Plotting [Contents][Index]
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.
Wait for mouse click or key press over the current figure window.
The return value of b is 0 if a mouse button was pressed or 1 if a key was pressed.
Place text on the current figure using the mouse.
The string argument s may be a character array or a cell array of strings. If s has more than one row, each row is used to create a separate text object after a mouse click. For example:
Place a single string after one mouse click
gtext ("I clicked here")
Place two strings after two mouse clicks
gtext ({"I clicked here"; "and there"})
Place two strings, each with two lines, after two mouse clicks
gtext ({"I clicked", "here"; "and", "there"})
Optional property/value pairs are passed directly to the underlying text objects.
The full list of text object properties is documented at Text Properties.
The optional return value h holds the graphics handle(s) to the created text object(s).
More sophisticated user interaction mechanisms can be obtained using the ui* family of functions, see UI Elements.
Next: Test Plotting Functions, Previous: Printing and Saving Plots, Up: High-Level Plotting [Contents][Index]