Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 404

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Plot Annotations - 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="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots" title="Three-Dimensional Plots">
<link rel="next" href="Multiple-Plots-on-One-Page.html#Multiple-Plots-on-One-Page" title="Multiple Plots on One Page">
<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="Plot-Annotations"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Multiple-Plots-on-One-Page.html#Multiple-Plots-on-One-Page">Multiple Plots on One Page</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots">Three-Dimensional Plots</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="High_002dLevel-Plotting.html#High_002dLevel-Plotting">High-Level Plotting</a>
<hr>
</div>

<h4 class="subsection">15.2.3 Plot Annotations</h4>

<p>You can add titles, axis labels, legends, and arbitrary text to an
existing plot.  For example:

<pre class="example">     x = -10:0.1:10;
     plot (x, sin (x));
     title ("sin(x) for x = -10:0.1:10");
     xlabel ("x");
     ylabel ("sin (x)");
     text (pi, 0.7, "arbitrary text");
     legend ("sin (x)");
</pre>
   <p>The functions <code>grid</code> and <code>box</code> may also be used to add grid
and border lines to the plot.  By default, the grid is off and the
border lines are on.

<!-- title scripts/plot/title.m -->
   <p><a name="doc_002dtitle"></a>

<div class="defun">
&mdash; Function File:  <b>title</b> (<var>string</var>)<var><a name="index-title-1364"></a></var><br>
&mdash; Function File:  <b>title</b> (<var>string, p1, v1, <small class="dots">...</small></var>)<var><a name="index-title-1365"></a></var><br>
&mdash; Function File:  <b>title</b> (<var>h, <small class="dots">...</small></var>)<var><a name="index-title-1366"></a></var><br>
&mdash; Function File: <var>h</var> = <b>title</b> (<var><small class="dots">...</small></var>)<var><a name="index-title-1367"></a></var><br>
<blockquote><p>Create a title object for a plot.

        <p>The optional return value <var>h</var> is a graphics handle to the created object. 
</p></blockquote></div>

<!-- legend scripts/plot/legend.m -->
   <p><a name="doc_002dlegend"></a>

<div class="defun">
&mdash; Function File:  <b>legend</b> (<var>str1, str2, <small class="dots">...</small></var>)<var><a name="index-legend-1368"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>matstr</var>)<var><a name="index-legend-1369"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>cell</var>)<var><a name="index-legend-1370"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var><small class="dots">...</small>, "location", pos</var>)<var><a name="index-legend-1371"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var><small class="dots">...</small>, "orientation", orient</var>)<var><a name="index-legend-1372"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>hax, <small class="dots">...</small></var>)<var><a name="index-legend-1373"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>hobjs, <small class="dots">...</small></var>)<var><a name="index-legend-1374"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>hax, hobjs, <small class="dots">...</small></var>)<var><a name="index-legend-1375"></a></var><br>
&mdash; Function File:  <b>legend</b> (<var>"option"</var>)<var><a name="index-legend-1376"></a></var><br>
<blockquote>
        <p>Display a legend for the axes with handle <var>hax</var>, or the current axes,
using the specified strings as labels.  Legend entries may be specified
as individual character string arguments, a character array, or a cell
array of character strings.  If the handles, <var>hobjs</var>, are not specified
then the legend's strings will be associated with the axes' descendants. 
Legend works on line graphs, bar graphs, etc. 
A plot must exist before legend is called.

        <p>The optional parameter <var>pos</var> specifies the location of the legend
as follows:

        <p><table summary="">
<tr align="left"><th valign="top" width="6%"></th><th valign="top" width="14%"><var>pos</var> </th><th valign="top" width="80%">
  location of the legend

     <p><br></th></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">north </td><td valign="top" width="80%">
  center top

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">south </td><td valign="top" width="80%">
  center bottom

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">east </td><td valign="top" width="80%">
  right center

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">west </td><td valign="top" width="80%">
  left center

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">northeast </td><td valign="top" width="80%">
  right top (default)

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">northwest </td><td valign="top" width="80%">
  left top

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">southeast </td><td valign="top" width="80%">
  right bottom

     <p><br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">southwest </td><td valign="top" width="80%">
  left bottom

     <p><br></td></tr><tr align="left"><td valign="top" width="6%">
<br></td></tr><tr align="left"><td valign="top" width="6%"></td><td valign="top" width="14%">outside </td><td valign="top" width="80%">
  can be appended to any location string
        <br></td></tr></table>

        <p>The optional parameter <var>orient</var> determines if the key elements
are placed vertically or horizontally.  The allowed values are "vertical"
or "horizontal" with the default being "vertical".

        <p>The following customizations are available using <var>option</var>:

          <dl>
<dt>"show"<dd>  Show legend on the plot

          <br><dt>"hide"<dd>  Hide legend on the plot

          <dt>"toggle"<dd>  Toggles between "hide" and "show"

          <br><dt>"boxon"<dd>  Show a box around legend

          <br><dt>"boxoff"<dd>  Hide the box around legend

          <br><dt>"left"<dd>  Place text to the left of the keys

          <br><dt>"right"<dd>  Place text to the right of the keys

          <dt>"off"<dd>  Delete the legend object
</dl>
        </p></blockquote></div>

<!-- text scripts/plot/text.m -->
   <p><a name="doc_002dtext"></a>

<div class="defun">
&mdash; Function File:  <b>text</b> (<var>x, y, label</var>)<var><a name="index-text-1377"></a></var><br>
&mdash; Function File:  <b>text</b> (<var>x, y, z, label</var>)<var><a name="index-text-1378"></a></var><br>
&mdash; Function File:  <b>text</b> (<var>x, y, label, p1, v1, <small class="dots">...</small></var>)<var><a name="index-text-1379"></a></var><br>
&mdash; Function File:  <b>text</b> (<var>x, y, z, label, p1, v1, <small class="dots">...</small></var>)<var><a name="index-text-1380"></a></var><br>
&mdash; Function File: <var>h</var> = <b>text</b> (<var><small class="dots">...</small></var>)<var><a name="index-text-1381"></a></var><br>
<blockquote><p>Create a text object with text <var>label</var> at position <var>x</var>,
<var>y</var>, <var>z</var> on the current axes.  Property-value pairs following
<var>label</var> may be used to specify the appearance of the text.

        <p>The optional return value <var>h</var> is a graphics handle to the created text
object. 
</p></blockquote></div>

   <p>See <a href="Text-Properties.html#Text-Properties">Text Properties</a> for the properties that you can set.

   <p><a name="doc_002dylabel"></a><a name="doc_002dzlabel"></a><!-- xlabel scripts/plot/xlabel.m -->
<a name="doc_002dxlabel"></a>

<div class="defun">
&mdash; Function File:  <b>xlabel</b> (<var>string</var>)<var><a name="index-xlabel-1382"></a></var><br>
&mdash; Function File:  <b>xlabel</b> (<var>h, string</var>)<var><a name="index-xlabel-1383"></a></var><br>
&mdash; Function File: <var>h</var> = <b>xlabel</b> (<var><small class="dots">...</small></var>)<var><a name="index-xlabel-1384"></a></var><br>
&mdash; Function File:  <b>ylabel</b> (<var><small class="dots">...</small></var>)<var><a name="index-ylabel-1385"></a></var><br>
&mdash; Function File:  <b>zlabel</b> (<var><small class="dots">...</small></var>)<var><a name="index-zlabel-1386"></a></var><br>
<blockquote><p>Specify x-, y-, or z-axis labels for the current axis.  If <var>h</var> is
specified then label the axis defined by <var>h</var>.

        <p>The optional return value <var>h</var> is a graphics handle to the created object. 
<!-- 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_002dtitle.html#doc_002dtitle">title</a>, <a href="doc_002dtext.html#doc_002dtext">text</a>. 
</p></blockquote></div>

<!-- clabel scripts/plot/clabel.m -->
   <p><a name="doc_002dclabel"></a>

<div class="defun">
&mdash; Function File:  <b>clabel</b> (<var>c, h</var>)<var><a name="index-clabel-1387"></a></var><br>
&mdash; Function File:  <b>clabel</b> (<var>c, h, v</var>)<var><a name="index-clabel-1388"></a></var><br>
&mdash; Function File:  <b>clabel</b> (<var>c, h, "manual"</var>)<var><a name="index-clabel-1389"></a></var><br>
&mdash; Function File:  <b>clabel</b> (<var>c</var>)<var><a name="index-clabel-1390"></a></var><br>
&mdash; Function File:  <b>clabel</b> (<var>c, h</var>)<var><a name="index-clabel-1391"></a></var><br>
&mdash; Function File:  <b>clabel</b> (<var><small class="dots">...</small>, prop, val, <small class="dots">...</small></var>)<var><a name="index-clabel-1392"></a></var><br>
&mdash; Function File: <var>h</var> = <b>clabel</b> (<var><small class="dots">...</small></var>)<var><a name="index-clabel-1393"></a></var><br>
<blockquote><p>Add labels to the contours of a contour plot.  The contour plot is specified
by the contour matrix <var>c</var> and optionally the contourgroup object <var>h</var>
that are returned by <code>contour</code>, <code>contourf</code> and <code>contour3</code>. 
The contour labels are rotated and placed in the contour itself.

        <p>By default, all contours are labeled.  However, the contours to label can be
specified by the vector <var>v</var>.  If the "manual" argument is given then
the contours to label can be selected with the mouse.

        <p>Additional property/value pairs that are valid properties of text objects
can be given and are passed to the underlying text objects.  Additionally,
the property "LabelSpacing" is available allowing the spacing between labels
on a contour (in points) to be specified.  The default is 144 points, or 2
inches.

        <p>The optional return value <var>h</var> is a vector of graphics handles to
the text objects representing each label. 
The "userdata" property of the text objects contains the numerical value of
the contour label.

        <p>An example of the use of <code>clabel</code> is

     <pre class="example">          [c, h] = contour (peaks (), -4 : 6);
          clabel (c, h, -4:2:6, "fontsize", 12);
</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_002dcontour.html#doc_002dcontour">contour</a>, <a href="doc_002dcontourf.html#doc_002dcontourf">contourf</a>, <a href="doc_002dcontour3.html#doc_002dcontour3">contour3</a>, <a href="doc_002dmeshc.html#doc_002dmeshc">meshc</a>, <a href="doc_002dsurfc.html#doc_002dsurfc">surfc</a>, <a href="doc_002dtext.html#doc_002dtext">text</a>. 
</p></blockquote></div>

<!-- box scripts/plot/box.m -->
   <p><a name="doc_002dbox"></a>

<div class="defun">
&mdash; Function File:  <b>box</b> (<var>arg</var>)<var><a name="index-box-1394"></a></var><br>
&mdash; Function File:  <b>box</b> (<var>h, <small class="dots">...</small></var>)<var><a name="index-box-1395"></a></var><br>
<blockquote><p>Control the display of a border around the plot. 
The argument may be either <code>"on"</code> or <code>"off"</code>.  If it is
omitted, the current box state is toggled. 
<!-- 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_002dgrid.html#doc_002dgrid">grid</a>. 
</p></blockquote></div>

<!-- grid scripts/plot/grid.m -->
   <p><a name="doc_002dgrid"></a>

<div class="defun">
&mdash; Function File:  <b>grid</b> (<var>arg</var>)<var><a name="index-grid-1396"></a></var><br>
&mdash; Function File:  <b>grid</b> (<var>"minor", arg2</var>)<var><a name="index-grid-1397"></a></var><br>
&mdash; Function File:  <b>grid</b> (<var>hax, <small class="dots">...</small></var>)<var><a name="index-grid-1398"></a></var><br>
<blockquote><p>Force the display of a grid on the plot. 
The argument may be either <code>"on"</code>, or <code>"off"</code>. 
If it is omitted, the current grid state is toggled.

        <p>If <var>arg</var> is <code>"minor"</code> then the minor grid is toggled.  When
using a minor grid a second argument <var>arg2</var> is allowed, which can
be either <code>"on"</code> or <code>"off"</code> to explicitly set the state of
the minor grid.

        <p>If the first argument is an axis handle, <var>hax</var>, operate on the
specified axis object. 
<!-- 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_002dplot.html#doc_002dplot">plot</a>. 
</p></blockquote></div>

<!-- colorbar scripts/plot/colorbar.m -->
   <p><a name="doc_002dcolorbar"></a>

<div class="defun">
&mdash; Function File:  <b>colorbar</b> (<var>s</var>)<var><a name="index-colorbar-1399"></a></var><br>
&mdash; Function File:  <b>colorbar</b> (<var>"peer", h, <small class="dots">...</small></var>)<var><a name="index-colorbar-1400"></a></var><br>
<blockquote><p>Add a colorbar to the current axes.  Valid values for <var>s</var> are

          <dl>
<dt>"EastOutside"<dd>Place the colorbar outside the plot to the right.  This is the default.

          <br><dt>"East"<dd>Place the colorbar inside the plot to the right.

          <br><dt>"WestOutside"<dd>Place the colorbar outside the plot to the left.

          <br><dt>"West"<dd>Place the colorbar inside the plot to the left.

          <br><dt>"NorthOutside"<dd>Place the colorbar above the plot.

          <br><dt>"North"<dd>Place the colorbar at the top of the plot.

          <br><dt>"SouthOutside"<dd>Place the colorbar under the plot.

          <br><dt>"South"<dd>Place the colorbar at the bottom of the plot.

          <br><dt>"Off", "None"<dd>Remove any existing colorbar from the plot. 
</dl>

        <p>If the argument "peer" is given, then the following argument is treated
as the axes handle on which to add the colorbar. 
</p></blockquote></div>

   </body></html>