(octave.info)Interacting with Plots


Next: Test Plotting Functions Prev: Printing and Saving Plots Up: High-Level Plotting
Enter node , (file) or (file)node

15.2.10 Interacting with Plots
------------------------------

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.

 -- : [X, Y, BUTTONS] = ginput (N)
 -- : [X, Y, BUTTONS] = ginput ()
     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: Note: gtext, *note waitforbuttonpress:
     XREFwaitforbuttonpress.

 -- : waitforbuttonpress ()
 -- : B = 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.

     See also: Note: waitfor, Note: ginput,
     Note: kbhit.

 -- : gtext (S)
 -- : gtext ({S1, S2, ...})
 -- : gtext ({S1; S2; ...})
 -- : gtext (..., PROP, VAL, ...)
 -- : H = gtext (...)
     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).

     See also: Note: ginput, Note: text.

   More sophisticated user interaction mechanisms can be obtained using
the ui* family of functions, Note: UI Elements.


automatically generated by info2www version 1.2.2.9