/usr/share/doc/octave/octave.html/Plot-Annotations.html is in octave-doc 4.2.2-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Plot Annotations (GNU Octave)</title>
<meta name="description" content="Plot Annotations (GNU Octave)">
<meta name="keywords" content="Plot Annotations (GNU Octave)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="High_002dLevel-Plotting.html#High_002dLevel-Plotting" rel="up" title="High-Level Plotting">
<link href="Multiple-Plots-on-One-Page.html#Multiple-Plots-on-One-Page" rel="next" title="Multiple Plots on One Page">
<link href="Three_002ddimensional-Geometric-Shapes.html#Three_002ddimensional-Geometric-Shapes" rel="prev" title="Three-dimensional Geometric Shapes">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<a name="Plot-Annotations"></a>
<div class="header">
<p>
Next: <a href="Multiple-Plots-on-One-Page.html#Multiple-Plots-on-One-Page" accesskey="n" rel="next">Multiple Plots on One Page</a>, Previous: <a href="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots" accesskey="p" rel="prev">Three-Dimensional Plots</a>, Up: <a href="High_002dLevel-Plotting.html#High_002dLevel-Plotting" accesskey="u" rel="up">High-Level Plotting</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Plot-Annotations-1"></a>
<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:
</p>
<div class="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></div>
<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.
</p>
<p>Finally, arrows, text and rectangular or elliptic boxes can be added to
highlight parts of a plot using the <code>annotation</code> function. Those objects
are drawn in an invisible axes, on top of every other axes.
</p>
<a name="XREFtitle"></a><dl>
<dt><a name="index-title"></a>: <em></em> <strong>title</strong> <em>(<var>string</var>)</em></dt>
<dt><a name="index-title-1"></a>: <em></em> <strong>title</strong> <em>(<var>string</var>, <var>prop</var>, <var>val</var>, …)</em></dt>
<dt><a name="index-title-2"></a>: <em></em> <strong>title</strong> <em>(<var>hax</var>, …)</em></dt>
<dt><a name="index-title-3"></a>: <em><var>h</var> =</em> <strong>title</strong> <em>(…)</em></dt>
<dd><p>Specify the string used as a title for the current axis.
</p>
<p>An optional list of <var>property</var>/<var>value</var> pairs can be used to change
the appearance of the created title text object.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then plot into this axes,
rather than the current axes returned by <code>gca</code>.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the created text
object.
</p>
<p><strong>See also:</strong> <a href="#XREFxlabel">xlabel</a>, <a href="#XREFylabel">ylabel</a>, <a href="#XREFzlabel">zlabel</a>, <a href="#XREFtext">text</a>.
</p></dd></dl>
<a name="XREFlegend"></a><dl>
<dt><a name="index-legend"></a>: <em></em> <strong>legend</strong> <em>(<var>str1</var>, <var>str2</var>, …)</em></dt>
<dt><a name="index-legend-1"></a>: <em></em> <strong>legend</strong> <em>(<var>matstr</var>)</em></dt>
<dt><a name="index-legend-2"></a>: <em></em> <strong>legend</strong> <em>(<var>cellstr</var>)</em></dt>
<dt><a name="index-legend-3"></a>: <em></em> <strong>legend</strong> <em>(…, "location", <var>pos</var>)</em></dt>
<dt><a name="index-legend-4"></a>: <em></em> <strong>legend</strong> <em>(…, "orientation", <var>orient</var>)</em></dt>
<dt><a name="index-legend-5"></a>: <em></em> <strong>legend</strong> <em>(<var>hax</var>, …)</em></dt>
<dt><a name="index-legend-6"></a>: <em></em> <strong>legend</strong> <em>(<var>hobjs</var>, …)</em></dt>
<dt><a name="index-legend-7"></a>: <em></em> <strong>legend</strong> <em>(<var>hax</var>, <var>hobjs</var>, …)</em></dt>
<dt><a name="index-legend-8"></a>: <em></em> <strong>legend</strong> <em>("<var>option</var>")</em></dt>
<dt><a name="index-legend-9"></a>: <em>[<var>hleg</var>, <var>hleg_obj</var>, <var>hplot</var>, <var>labels</var>] =</em> <strong>legend</strong> <em>(…)</em></dt>
<dd>
<p>Display a legend for the current axes using the specified strings as labels.
</p>
<p>Legend entries may be specified as individual character string arguments,
a character array, or a cell array of character strings.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then plot into this axes,
rather than the current axes returned by <code>gca</code>. If the handles,
<var>hobjs</var>, are not specified then the legend’s strings will be associated
with the axes’ descendants. <code>legend</code> works on line graphs,
bar graphs, etc. A plot must exist before legend is called.
</p>
<p>The optional parameter <var>pos</var> specifies the location of the legend
as follows:
</p>
<table>
<thead><tr><th width="6%"></th><th width="14%">pos</th><th width="80%">location of the legend</th></tr></thead>
<tr><td width="6%"></td><td width="14%">north</td><td width="80%">center top</td></tr>
<tr><td width="6%"></td><td width="14%">south</td><td width="80%">center bottom</td></tr>
<tr><td width="6%"></td><td width="14%">east</td><td width="80%">right center</td></tr>
<tr><td width="6%"></td><td width="14%">west</td><td width="80%">left center</td></tr>
<tr><td width="6%"></td><td width="14%">northeast</td><td width="80%">right top (default)</td></tr>
<tr><td width="6%"></td><td width="14%">northwest</td><td width="80%">left top</td></tr>
<tr><td width="6%"></td><td width="14%">southeast</td><td width="80%">right bottom</td></tr>
<tr><td width="6%"></td><td width="14%">southwest</td><td width="80%">left bottom</td></tr>
<tr><td width="6%"></td></tr>
<tr><td width="6%"></td><td width="14%">outside</td><td width="80%">can be appended to any location string</td></tr>
</table>
<p>The optional parameter <var>orient</var> determines if the key elements are
placed vertically or horizontally. The allowed values are
<code>"vertical"</code> (default) or <code>"horizontal"</code>.
</p>
<p>The following customizations are available using <var>option</var>:
</p>
<dl compact="compact">
<dt><code>"show"</code></dt>
<dd><p>Show legend on the plot
</p>
</dd>
<dt><code>"hide"</code></dt>
<dd><p>Hide legend on the plot
</p>
</dd>
<dt><code>"toggle"</code></dt>
<dd><p>Toggles between <code>"hide"</code> and <code>"show"</code>
</p>
</dd>
<dt><code>"boxon"</code></dt>
<dd><p>Show a box around legend (default)
</p>
</dd>
<dt><code>"boxoff"</code></dt>
<dd><p>Hide the box around legend
</p>
</dd>
<dt><code>"right"</code></dt>
<dd><p>Place label text to the right of the keys (default)
</p>
</dd>
<dt><code>"left"</code></dt>
<dd><p>Place label text to the left of the keys
</p>
</dd>
<dt><code>"off"</code></dt>
<dd><p>Delete the legend object
</p></dd>
</dl>
<p>The optional output values are
</p>
<dl compact="compact">
<dt><var>hleg</var></dt>
<dd><p>The graphics handle of the legend object.
</p>
</dd>
<dt><var>hleg_obj</var></dt>
<dd><p>Graphics handles to the text and line objects which make up the legend.
</p>
</dd>
<dt><var>hplot</var></dt>
<dd><p>Graphics handles to the plot objects which were used in making the legend.
</p>
</dd>
<dt><var>labels</var></dt>
<dd><p>A cell array of strings of the labels in the legend.
</p></dd>
</dl>
<p>The legend label text is either provided in the call to <code>legend</code> or
is taken from the DisplayName property of graphics objects. If no
labels or DisplayNames are available, then the label text is simply
<code>"data1"</code>, <code>"data2"</code>, …, <code>"dataN"</code>.
</p>
<p>Implementation Note: A legend is implemented as an additional axes object
of the current figure with the <code>"tag"</code> set to <code>"legend"</code>.
Properties of the legend object may be manipulated directly by using
<code>set</code>.
</p></dd></dl>
<a name="XREFtext"></a><dl>
<dt><a name="index-text"></a>: <em></em> <strong>text</strong> <em>(<var>x</var>, <var>y</var>, <var>string</var>)</em></dt>
<dt><a name="index-text-1"></a>: <em></em> <strong>text</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>string</var>)</em></dt>
<dt><a name="index-text-2"></a>: <em></em> <strong>text</strong> <em>(…, <var>prop</var>, <var>val</var>, …)</em></dt>
<dt><a name="index-text-3"></a>: <em><var>h</var> =</em> <strong>text</strong> <em>(…)</em></dt>
<dd><p>Create a text object with text <var>string</var> at position <var>x</var>, <var>y</var>,
(<var>z</var>) on the current axes.
</p>
<p>Multiple locations can be specified if <var>x</var>, <var>y</var>, (<var>z</var>) are
vectors. Multiple strings can be specified with a character matrix or
a cell array of strings.
</p>
<p>Optional property/value pairs may be used to control the appearance of the
text.
</p>
<p>The optional return value <var>h</var> is a vector of graphics handles to the
created text objects.
</p>
<p><strong>See also:</strong> <a href="Interacting-with-Plots.html#XREFgtext">gtext</a>, <a href="#XREFtitle">title</a>, <a href="#XREFxlabel">xlabel</a>, <a href="#XREFylabel">ylabel</a>, <a href="#XREFzlabel">zlabel</a>.
</p></dd></dl>
<p>See <a href="Text-Properties.html#Text-Properties">Text Properties</a> for the properties that you can set.
</p>
<a name="XREFylabel"></a><a name="XREFzlabel"></a><a name="XREFxlabel"></a><dl>
<dt><a name="index-xlabel"></a>: <em></em> <strong>xlabel</strong> <em>(<var>string</var>)</em></dt>
<dt><a name="index-xlabel-1"></a>: <em></em> <strong>xlabel</strong> <em>(<var>string</var>, <var>property</var>, <var>val</var>, …)</em></dt>
<dt><a name="index-xlabel-2"></a>: <em></em> <strong>xlabel</strong> <em>(<var>hax</var>, …)</em></dt>
<dt><a name="index-xlabel-3"></a>: <em><var>h</var> =</em> <strong>xlabel</strong> <em>(…)</em></dt>
<dd><p>Specify the string used to label the x-axis of the current axis.
</p>
<p>An optional list of <var>property</var>/<var>value</var> pairs can be used to change
the properties of the created text label.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then operate on
this axes rather than the current axes returned by <code>gca</code>.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the created text
object.
</p>
<p><strong>See also:</strong> <a href="#XREFylabel">ylabel</a>, <a href="#XREFzlabel">zlabel</a>, <a href="Timing-Utilities.html#XREFdatetick">datetick</a>, <a href="#XREFtitle">title</a>, <a href="#XREFtext">text</a>.
</p></dd></dl>
<a name="XREFclabel"></a><dl>
<dt><a name="index-clabel"></a>: <em></em> <strong>clabel</strong> <em>(<var>c</var>, <var>h</var>)</em></dt>
<dt><a name="index-clabel-1"></a>: <em></em> <strong>clabel</strong> <em>(<var>c</var>, <var>h</var>, <var>v</var>)</em></dt>
<dt><a name="index-clabel-2"></a>: <em></em> <strong>clabel</strong> <em>(<var>c</var>, <var>h</var>, "manual")</em></dt>
<dt><a name="index-clabel-3"></a>: <em></em> <strong>clabel</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-clabel-4"></a>: <em></em> <strong>clabel</strong> <em>(…, <var>prop</var>, <var>val</var>, …)</em></dt>
<dt><a name="index-clabel-5"></a>: <em><var>h</var> =</em> <strong>clabel</strong> <em>(…)</em></dt>
<dd><p>Add labels to the contours of a contour plot.
</p>
<p>The contour levels are specified by the contour matrix <var>c</var> which is
returned by <code>contour</code>, <code>contourc</code>, <code>contourf</code>, and
<code>contour3</code>. Contour labels are rotated to match the local line
orientation and centered on the line. The position of labels along the
contour line is chosen randomly.
</p>
<p>If the argument <var>h</var> is a handle to a contour group object, then label
this plot rather than the one in the current axes returned by <code>gca</code>.
</p>
<p>By default, all contours are labeled. However, the contours to label can be
specified by the vector <var>v</var>. If the <code>"manual"</code> argument is
given then the contours to label can be selected with the mouse.
</p>
<p>Additional property/value pairs that are valid properties of text objects
can be given and are passed to the underlying text objects. Moreover,
the contour group property <code>"LabelSpacing"</code> is available which
determines the spacing between labels on a contour to be specified. The
default is 144 points, or 2 inches.
</p>
<p>The optional return value <var>h</var> is a vector of graphics handles to
the text objects representing each label.
The <code>"userdata"</code> property of the text objects contains the numerical
value of the contour label.
</p>
<p>An example of the use of <code>clabel</code> is
</p>
<div class="example">
<pre class="example">[c, h] = contour (peaks (), -4 : 6);
clabel (c, h, -4:2:6, "fontsize", 12);
</pre></div>
<p><strong>See also:</strong> <a href="Two_002dDimensional-Plots.html#XREFcontour">contour</a>, <a href="Two_002dDimensional-Plots.html#XREFcontourf">contourf</a>, <a href="Two_002dDimensional-Plots.html#XREFcontour3">contour3</a>, <a href="Three_002dDimensional-Plots.html#XREFmeshc">meshc</a>, <a href="Three_002dDimensional-Plots.html#XREFsurfc">surfc</a>, <a href="#XREFtext">text</a>.
</p></dd></dl>
<a name="XREFbox"></a><dl>
<dt><a name="index-box"></a>: <em></em> <strong>box</strong></dt>
<dt><a name="index-box-1"></a>: <em></em> <strong>box</strong> <em>on</em></dt>
<dt><a name="index-box-2"></a>: <em></em> <strong>box</strong> <em>off</em></dt>
<dt><a name="index-box-3"></a>: <em></em> <strong>box</strong> <em>(<var>hax</var>, …)</em></dt>
<dd><p>Control display of the axes border.
</p>
<p>The argument may be either <code>"on"</code> or <code>"off"</code>. If it is
omitted, the current box state is toggled.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then operate on this
axes rather than the current axes returned by <code>gca</code>.
</p>
<p><strong>See also:</strong> <a href="Axis-Configuration.html#XREFaxis">axis</a>, <a href="#XREFgrid">grid</a>.
</p></dd></dl>
<a name="XREFgrid"></a><dl>
<dt><a name="index-grid"></a>: <em></em> <strong>grid</strong></dt>
<dt><a name="index-grid-1"></a>: <em></em> <strong>grid</strong> <em>on</em></dt>
<dt><a name="index-grid-2"></a>: <em></em> <strong>grid</strong> <em>off</em></dt>
<dt><a name="index-grid-3"></a>: <em></em> <strong>grid</strong> <em>minor</em></dt>
<dt><a name="index-grid-4"></a>: <em></em> <strong>grid</strong> <em>minor on</em></dt>
<dt><a name="index-grid-5"></a>: <em></em> <strong>grid</strong> <em>minor off</em></dt>
<dt><a name="index-grid-6"></a>: <em></em> <strong>grid</strong> <em>(<var>hax</var>, …)</em></dt>
<dd><p>Control the display of plot grid lines.
</p>
<p>The function state input may be either <code>"on"</code> or <code>"off"</code>.
If it is omitted, the current grid state is toggled.
</p>
<p>When the first argument is <code>"minor"</code> all subsequent commands
modify the minor grid rather than the major grid.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then operate on
this axes rather than the current axes returned by <code>gca</code>.
</p>
<p>To control the grid lines for an individual axes use the <code>set</code>
function. For example:
</p>
<div class="example">
<pre class="example">set (gca, "ygrid", "on");
</pre></div>
<p><strong>See also:</strong> <a href="Axis-Configuration.html#XREFaxis">axis</a>, <a href="#XREFbox">box</a>.
</p></dd></dl>
<a name="XREFcolorbar"></a><dl>
<dt><a name="index-colorbar"></a>: <em></em> <strong>colorbar</strong></dt>
<dt><a name="index-colorbar-1"></a>: <em></em> <strong>colorbar</strong> <em>(<var>loc</var>)</em></dt>
<dt><a name="index-colorbar-2"></a>: <em></em> <strong>colorbar</strong> <em>(<var>delete_option</var>)</em></dt>
<dt><a name="index-colorbar-3"></a>: <em></em> <strong>colorbar</strong> <em>(<var>hcb</var>, …)</em></dt>
<dt><a name="index-colorbar-4"></a>: <em></em> <strong>colorbar</strong> <em>(<var>hax</var>, …)</em></dt>
<dt><a name="index-colorbar-5"></a>: <em></em> <strong>colorbar</strong> <em>(…, "peer", <var>hax</var>, …)</em></dt>
<dt><a name="index-colorbar-6"></a>: <em></em> <strong>colorbar</strong> <em>(…, "location", <var>loc</var>, …)</em></dt>
<dt><a name="index-colorbar-7"></a>: <em></em> <strong>colorbar</strong> <em>(…, <var>prop</var>, <var>val</var>, …)</em></dt>
<dt><a name="index-colorbar-8"></a>: <em><var>h</var> =</em> <strong>colorbar</strong> <em>(…)</em></dt>
<dd><p>Add a colorbar to the current axes.
</p>
<p>A colorbar displays the current colormap along with numerical rulings
so that the color scale can be interpreted.
</p>
<p>The optional input <var>loc</var> determines the location of the colorbar.
Valid values for <var>loc</var> are
</p>
<dl compact="compact">
<dt><code>"EastOutside"</code></dt>
<dd><p>Place the colorbar outside the plot to the right. This is the default.
</p>
</dd>
<dt><code>"East"</code></dt>
<dd><p>Place the colorbar inside the plot to the right.
</p>
</dd>
<dt><code>"WestOutside"</code></dt>
<dd><p>Place the colorbar outside the plot to the left.
</p>
</dd>
<dt><code>"West"</code></dt>
<dd><p>Place the colorbar inside the plot to the left.
</p>
</dd>
<dt><code>"NorthOutside"</code></dt>
<dd><p>Place the colorbar above the plot.
</p>
</dd>
<dt><code>"North"</code></dt>
<dd><p>Place the colorbar at the top of the plot.
</p>
</dd>
<dt><code>"SouthOutside"</code></dt>
<dd><p>Place the colorbar under the plot.
</p>
</dd>
<dt><code>"South"</code></dt>
<dd><p>Place the colorbar at the bottom of the plot.
</p></dd>
</dl>
<p>To remove a colorbar from a plot use any one of the following keywords for
the <var>delete_option</var>: <code>"delete"</code>, <code>"hide"</code>, <code>"off"</code>.
</p>
<p>If the argument <code>"peer"</code> is given, then the following argument is
treated as the axes handle in which to add the colorbar. Alternatively,
If the first argument <var>hax</var> is an axes handle, then the colorbar is
added to this axes, rather than the current axes returned by <code>gca</code>.
</p>
<p>If the first argument <var>hcb</var> is a handle to a colorbar object, then
operate on this colorbar directly.
</p>
<p>Additional property/value pairs are passed directly to the underlying axes
object.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the created
colorbar object.
</p>
<p>Implementation Note: A colorbar is created as an additional axes to the
current figure with the <code>"tag"</code> property set to <code>"colorbar"</code>.
The created axes object has the extra property <code>"location"</code> which
controls the positioning of the colorbar.
</p>
<p><strong>See also:</strong> <a href="Representing-Images.html#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFannotation"></a><dl>
<dt><a name="index-annotation"></a>: <em></em> <strong>annotation</strong> <em>(<var>type</var>)</em></dt>
<dt><a name="index-annotation-1"></a>: <em></em> <strong>annotation</strong> <em>("line", <var>x</var>, <var>y</var>)</em></dt>
<dt><a name="index-annotation-2"></a>: <em></em> <strong>annotation</strong> <em>("arrow", <var>x</var>, <var>y</var>)</em></dt>
<dt><a name="index-annotation-3"></a>: <em></em> <strong>annotation</strong> <em>("doublearrow", <var>x</var>, <var>y</var>)</em></dt>
<dt><a name="index-annotation-4"></a>: <em></em> <strong>annotation</strong> <em>("textarrow", <var>x</var>, <var>y</var>)</em></dt>
<dt><a name="index-annotation-5"></a>: <em></em> <strong>annotation</strong> <em>("textbox", <var>pos</var>)</em></dt>
<dt><a name="index-annotation-6"></a>: <em></em> <strong>annotation</strong> <em>("rectangle", <var>pos</var>)</em></dt>
<dt><a name="index-annotation-7"></a>: <em></em> <strong>annotation</strong> <em>("ellipse", <var>pos</var>)</em></dt>
<dt><a name="index-annotation-8"></a>: <em></em> <strong>annotation</strong> <em>(…, <var>prop</var>, <var>val</var>)</em></dt>
<dt><a name="index-annotation-9"></a>: <em></em> <strong>annotation</strong> <em>(<var>hf</var>, …)</em></dt>
<dt><a name="index-annotation-10"></a>: <em><var>h</var> =</em> <strong>annotation</strong> <em>(…)</em></dt>
<dd><p>Draw annotations to emphasize parts of a figure.
</p>
<p>You may build a default annotation by specifying only the <var>type</var>
of the annotation.
</p>
<p>Otherwise you can select the type of annotation and then set its position
using either <var>x</var> and <var>y</var> coordinates for line-based annotations or a
position vector <var>pos</var> for others. In either case, coordinates are
interpreted using the <code>"units"</code> property of the annotation object.
The default is <code>"normalized"</code>, which means the lower left hand corner
of the figure has coordinates ‘<samp>[0 0]</samp>’ and the upper right hand corner
‘<samp>[1 1]</samp>’.
</p>
<p>If the first argument <var>hf</var> is a figure handle, then plot into this
figure, rather than the current figure returned by <code>gcf</code>.
</p>
<p>Further arguments can be provided in the form of <var>prop</var>/<var>val</var> pairs
to customize the annotation appearance.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the created
annotation object. This can be used with the <code>set</code> function to
customize an existing annotation object.
</p>
<p>All annotation objects share two properties:
</p>
<ul>
<li> <code>"units"</code>: the units in which coordinates are interpreted.<br>
Its value may be one of <code>"centimeters"</code> | <code>"characters"</code> |
<code>"inches"</code> | <code>"{normalized}"</code> | <code>"pixels"</code> |
<code>"points"</code>.
</li><li> <code>"position"</code>: a four-element vector [x0 y0 width height].<br>
The vector specifies the coordinates (x0,y0) of the origin of the annotation
object, its width, and its height. The width and height may be negative,
depending on the orientation of the object.
</li></ul>
<p>Valid annotation types and their specific properties are described
below:
</p>
<dl compact="compact">
<dt><code>"line"</code></dt>
<dd><p>Constructs a line. <var>x</var> and <var>y</var> must be two-element vectors
specifying the x and y coordinates of the two ends of the line.
</p>
<p>The line can be customized using <code>"linewidth"</code>, <code>"linestyle"</code>,
and <code>"color"</code> properties the same way as for <code>line</code> objects.
</p>
</dd>
<dt><code>"arrow"</code></dt>
<dd><p>Construct an arrow. The second point in vectors <var>x</var> and <var>y</var>
specifies the arrowhead coordinates.
</p>
<p>Besides line properties, the arrowhead can be customized using
<code>"headlength"</code>, <code>"headwidth"</code>, and <code>"headstyle"</code>
properties. Supported values for <code>"headstyle"</code> property are:
[<code>"diamond"</code> | <code>"ellipse"</code> | <code>"plain"</code> |
<code>"rectangle"</code> | <code>"vback1"</code> | <code>"{vback2}"</code> |
<code>"vback3"</code>]
</p>
</dd>
<dt><code>"doublearrow"</code></dt>
<dd><p>Construct a double arrow. Vectors <var>x</var> and <var>y</var> specify the
arrowhead coordinates.
</p>
<p>The line and the arrowhead can be customized as for arrow annotations, but
some property names are duplicated:
<code>"head1length"</code>/<code>"head2length"</code>,
<code>"head1width"</code>/<code>"head2width"</code>, etc. The index 1 marks the
properties of the arrowhead at the first point in <var>x</var> and <var>y</var>
coordinates.
</p>
</dd>
<dt><code>"textarrow"</code></dt>
<dd><p>Construct an arrow with a text label at the opposite end from the arrowhead.
</p>
<p>Use the <code>"string"</code> property to change the text string.
The line and the arrowhead can be customized as for arrow annotations, and
the text can be customized using the same properties as <code>text</code> graphics
objects. Note, however, that some text property names are prefixed with
"text" to distinguish them from arrow properties:
<code>"textbackgroundcolor"</code>, <code>"textcolor"</code>,
<code>"textedgecolor"</code>, <code>"textlinewidth"</code>,
<code>"textmargin"</code>, <code>"textrotation"</code>.
</p>
</dd>
<dt><code>"textbox"</code></dt>
<dd><p>Construct a box with text inside. <var>pos</var> specifies the
<code>"position"</code> property of the annotation.
</p>
<p>Use the <code>"string"</code> property to change the text string.
You may use <code>"backgroundcolor"</code>, <code>"edgecolor"</code>,
<code>"linestyle"</code>, and <code>"linewidth"</code> properties to customize
the box background color and edge appearance. A limited set of <code>text</code>
objects properties are also available; Besides <code>"font…"</code>
properties, you may also use <code>"horizontalalignment"</code> and
<code>"verticalalignment"</code> to position the text inside the box.
</p>
<p>Finally, the <code>"fitboxtotext"</code> property controls the actual extent of
the box. If <code>"on"</code> (the default) the box limits are fitted to the
text extent.
</p>
</dd>
<dt><code>"rectangle"</code></dt>
<dd><p>Construct a rectangle. <var>pos</var> specifies the <code>"position"</code> property
of the annotation.
</p>
<p>You may use <code>"facecolor"</code>, <code>"color"</code>, <code>"linestyle"</code>, and
<code>"linewidth"</code> properties to customize the rectangle background color
and edge appearance.
</p>
</dd>
<dt><code>"ellipse"</code></dt>
<dd><p>Construct an ellipse. <var>pos</var> specifies the <code>"position"</code> property
of the annotation.
</p>
<p>See <code>"rectangle"</code> annotations for customization.
</p></dd>
</dl>
<p><strong>See also:</strong> <a href="#XREFxlabel">xlabel</a>, <a href="#XREFylabel">ylabel</a>, <a href="#XREFzlabel">zlabel</a>, <a href="#XREFtitle">title</a>, <a href="#XREFtext">text</a>, <a href="Interacting-with-Plots.html#XREFgtext">gtext</a>, <a href="#XREFlegend">legend</a>, <a href="#XREFcolorbar">colorbar</a>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Multiple-Plots-on-One-Page.html#Multiple-Plots-on-One-Page" accesskey="n" rel="next">Multiple Plots on One Page</a>, Previous: <a href="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots" accesskey="p" rel="prev">Three-Dimensional Plots</a>, Up: <a href="High_002dLevel-Plotting.html#High_002dLevel-Plotting" accesskey="u" rel="up">High-Level Plotting</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|