1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
<html lang="en">
<head>
<title>Interacting with Plots - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="High_002dLevel-Plotting.html#High_002dLevel-Plotting" title="High-Level Plotting">
<link rel="prev" href="Printing-and-Saving-Plots.html#Printing-and-Saving-Plots" title="Printing and Saving Plots">
<link rel="next" href="Test-Plotting-Functions.html#Test-Plotting-Functions" title="Test Plotting Functions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Interacting-with-Plots"></a>
<p>
Next: <a rel="next" accesskey="n" href="Test-Plotting-Functions.html#Test-Plotting-Functions">Test Plotting Functions</a>,
Previous: <a rel="previous" accesskey="p" href="Printing-and-Saving-Plots.html#Printing-and-Saving-Plots">Printing and Saving Plots</a>,
Up: <a rel="up" accesskey="u" href="High_002dLevel-Plotting.html#High_002dLevel-Plotting">High-Level Plotting</a>
<hr>
</div>
<h4 class="subsection">15.2.10 Interacting with Plots</h4>
<p>The user can select points on a plot with the <code>ginput</code> function or
selection the position at which to place text on the plot with the
<code>gtext</code> function using the mouse. Menus may also be created
and populated with specific user commands via the <code>uimenu</code> function.
<!-- ginput scripts/plot/ginput.m -->
<p><a name="doc_002dginput"></a>
<div class="defun">
— Function File: [<var>x</var>, <var>y</var>, <var>buttons</var>] = <b>ginput</b> (<var>n</var>)<var><a name="index-ginput-1472"></a></var><br>
<blockquote><p>Return which mouse buttons were pressed and keys were hit on the current
figure. If <var>n</var> is defined, then wait for <var>n</var> mouse clicks
before returning. If <var>n</var> is not defined, then <code>ginput</code> will
loop until the return key <RET> is pressed.
</p></blockquote></div>
<!-- waitforbuttonpress scripts/plot/waitforbuttonpress.m -->
<p><a name="doc_002dwaitforbuttonpress"></a>
<div class="defun">
— Function File: <var>b</var> = <b>waitforbuttonpress</b> ()<var><a name="index-waitforbuttonpress-1473"></a></var><br>
<blockquote><p>Wait for button or mouse press.over a figure window. The value of
<var>b</var> returns 0 if a mouse button was pressed or 1 is a key was
pressed.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dginput.html#doc_002dginput">ginput</a>.
</p></blockquote></div>
<!-- gtext scripts/plot/gtext.m -->
<p><a name="doc_002dgtext"></a>
<div class="defun">
— Function File: <b>gtext</b> (<var>s</var>)<var><a name="index-gtext-1474"></a></var><br>
— Function File: <b>gtext</b> (<var>{s1; s2; <small class="dots">...</small>}</var>)<var><a name="index-gtext-1475"></a></var><br>
— Function File: <b>gtext</b> (<var><small class="dots">...</small>, prop, val</var>)<var><a name="index-gtext-1476"></a></var><br>
<blockquote><p>Place text on the current figure using the mouse. The text is defined
by the string <var>s</var>. If <var>s</var> is a cell array, each element of the cell
array is written to a separate line. Additional arguments are passed to
the underlying text object as properties.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dginput.html#doc_002dginput">ginput</a>, <a href="doc_002dtext.html#doc_002dtext">text</a>.
</p></blockquote></div>
<!-- uimenu scripts/plot/uimenu.m -->
<p><a name="doc_002duimenu"></a>
<div class="defun">
— Function File: <b>uimenu</b> (<var>property, value, <small class="dots">...</small></var>)<var><a name="index-uimenu-1477"></a></var><br>
— Function File: <b>uimenu</b> (<var>h, property, value, <small class="dots">...</small></var>)<var><a name="index-uimenu-1478"></a></var><br>
<blockquote><p>Create a uimenu object and return a handle to it. If <var>h</var> is ommited
then a top-level menu for the current figure is created. If <var>h</var>
is given then a submenu relative to <var>h</var> is created.
<p>uimenu objects have the following specific properties:
<dl>
<dt>"accelerator"<dd>A string containing the key combination together with CTRL to execute this
menu entry (e.g., "x" for CTRL+x).
<br><dt>"callback"<dd>Is the function called when this menu entry is executed. It can be either a
function string (e.g., "myfun"), a function handle (e.g., @myfun) or a cell
array containing the function handle and arguments for the callback
function (e.g., {@myfun, arg1, arg2}).
<br><dt>"checked"<dd>Can be set "on" or "off". Sets a mark at this menu entry.
<br><dt>"enable"<dd>Can be set "on" or "off". If disabled the menu entry cannot be selected
and it is grayed out.
<br><dt>"foregroundcolor"<dd>A color value setting the text color for this menu entry.
<br><dt>"label"<dd>A string containing the label for this menu entry. A "&"-symbol can be
used to mark the "accelerator" character (e.g., "E&xit")
<br><dt>"position"<dd>An scalar value containing the relative menu position. The entry with the
lowest value is at the first position starting from left or top.
<br><dt>"separator"<dd>Can be set "on" or "off". If enabled it draws a separator line above the
current position. It is ignored for top level entries.
</dl>
<p>Examples:
<pre class="example"> f = uimenu ("label", "&File", "accelerator", "f");
e = uimenu ("label", "&Edit", "accelerator", "e");
uimenu (f, "label", "Close", "accelerator", "q", ...
"callback", "close (gcf)");
uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
"callback", "grid (gca)");
</pre>
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dfigure.html#doc_002dfigure">figure</a>.
</p></blockquote></div>
</body></html>
|