/usr/share/doc/octave/octave.html/Printing-and-Saving-Plots.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 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | <!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>Printing and Saving Plots (GNU Octave)</title>
<meta name="description" content="Printing and Saving Plots (GNU Octave)">
<meta name="keywords" content="Printing and Saving Plots (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="Interacting-with-Plots.html#Interacting-with-Plots" rel="next" title="Interacting with Plots">
<link href="Use-of-the-interpreter-Property.html#Use-of-the-interpreter-Property" rel="prev" title="Use of the interpreter Property">
<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="Printing-and-Saving-Plots"></a>
<div class="header">
<p>
Next: <a href="Interacting-with-Plots.html#Interacting-with-Plots" accesskey="n" rel="next">Interacting with Plots</a>, Previous: <a href="Use-of-the-interpreter-Property.html#Use-of-the-interpreter-Property" accesskey="p" rel="prev">Use of the <code>interpreter</code> Property</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="Printing-and-Saving-Plots-1"></a>
<h4 class="subsection">15.2.9 Printing and Saving Plots</h4>
<a name="index-plotting_002c-saving-and-printing-plots"></a>
<a name="index-printing-plots"></a>
<a name="index-saving-plots"></a>
<p>The <code>print</code> command allows you to send plots to you printer and
to save plots in a variety of formats. For example,
</p>
<div class="example">
<pre class="example">print -dpsc
</pre></div>
<p>prints the current figure to a color PostScript printer. And,
</p>
<div class="example">
<pre class="example">print -deps foo.eps
</pre></div>
<p>saves the current figure to an encapsulated PostScript file called
<samp>foo.eps</samp>.
</p>
<p>The current graphic toolkits produce very similar graphic displays but differ
in their capability to display text and in print capabilities. In particular,
the OpenGL based toolkits such as <code>fltk</code> and <code>qt</code> do not support the
<code>"interpreter"</code> property of text objects. This means that when using
OpenGL toolkits special symbols drawn with the <code>"tex"</code> interpreter will
appear correctly on-screen but will be rendered with interpreter <code>"none"</code>
when printing unless one of the <code>standalone</code> (see below) modes is used.
These modes provide access to the pdflatex processor and therefore allow full
use of LaTeX commands.
</p>
<p>A complete example showing the capabilities of text printing using the
<samp>-dpdflatexstandalone</samp> option is:
</p>
<div class="example">
<pre class="example">x = 0:0.01:3;
hf = figure ();
plot (x, erf (x));
hold on;
plot (x, x, "r");
axis ([0, 3, 0, 1]);
text (0.65, 0.6175, ['$\displaystyle\leftarrow x = {2\over\sqrt{\pi}}'...
'\int_{0}^{x}e^{-t^2} dt = 0.6175$']);
xlabel ("x");
ylabel ("erf (x)");
title ("erf (x) with text annotation");
set (hf, "visible", "off");
print (hf, "plot15_7.pdf", "-dpdflatexstandalone");
set (hf, "visible", "on");
system ("pdflatex plot15_7");
open ("plot15_7.pdf");
</pre></div>
<p>The result of this example can be seen in <a href="#fig_003aextendedtext">Figure 15.7</a>
</p>
<div class="float"><a name="fig_003aextendedtext"></a>
<div align="center"><img src="extended.png" alt="extended">
</div>
<div class="float-caption"><p><strong>Figure 15.7: </strong>Example of inclusion of text with use of <samp>-dpdflatexstandalone</samp></p></div></div>
<a name="XREFprint"></a><dl>
<dt><a name="index-print"></a>: <em></em> <strong>print</strong> <em>()</em></dt>
<dt><a name="index-print-1"></a>: <em></em> <strong>print</strong> <em>(<var>options</var>)</em></dt>
<dt><a name="index-print-2"></a>: <em></em> <strong>print</strong> <em>(<var>filename</var>, <var>options</var>)</em></dt>
<dt><a name="index-print-3"></a>: <em></em> <strong>print</strong> <em>(<var>h</var>, <var>filename</var>, <var>options</var>)</em></dt>
<dd><p>Print a plot, or save it to a file.
</p>
<p>Both output formatted for printing (PDF and PostScript), and many bitmapped
and vector image formats are supported.
</p>
<p><var>filename</var> defines the name of the output file. If the filename has
no suffix, one is inferred from the specified device and appended to the
filename. If no filename is specified, the output is sent to the
printer.
</p>
<p><var>h</var> specifies the handle of the figure to print. If no handle is
specified the current figure is used.
</p>
<p>For output to a printer, PostScript file, or PDF file, the paper size is
specified by the figure’s <code>papersize</code> property. The location and
size of the image on the page are specified by the figure’s
<code>paperposition</code> property. The orientation of the page is specified
by the figure’s <code>paperorientation</code> property.
</p>
<p>The width and height of images are specified by the figure’s
<code>paperposition(3:4)</code> property values.
</p>
<p>The <code>print</code> command supports many <var>options</var>:
</p>
<dl compact="compact">
<dt><code>-f<var>h</var></code></dt>
<dd><p>Specify the handle, <var>h</var>, of the figure to be printed. The default
is the current figure.
</p>
</dd>
<dt><code>-P<var>printer</var></code></dt>
<dd><p>Set the <var>printer</var> name to which the plot is sent if no
<var>filename</var> is specified.
</p>
</dd>
<dt><code>-G<var>ghostscript_command</var></code></dt>
<dd><p>Specify the command for calling Ghostscript. For Unix and Windows the
defaults are <code>"gs"</code> and <code>"gswin32c"</code>, respectively.
</p>
</dd>
<dt><code>-color</code></dt>
<dt><code>-mono</code></dt>
<dd><p>Color or monochrome output.
</p>
</dd>
<dt><code>-solid</code></dt>
<dt><code>-dashed</code></dt>
<dd><p>Force all lines to be solid or dashed, respectively.
</p>
</dd>
<dt><code>-portrait</code></dt>
<dt><code>-landscape</code></dt>
<dd><p>Specify the orientation of the plot for printed output.
For non-printed output the aspect ratio of the output corresponds to the
plot area defined by the <code>"paperposition"</code> property in the
orientation specified. This option is equivalent to changing the figure’s
<code>"paperorientation"</code> property.
</p>
</dd>
<dt><code>-TextAlphaBits=<var>n</var></code></dt>
<dt><code>-GraphicsAlphaBits=<var>n</var></code></dt>
<dd><p>Octave is able to produce output for various printers, bitmaps, and
vector formats by using Ghostscript. For bitmap and printer output
anti-aliasing is applied using Ghostscript’s TextAlphaBits and
GraphicsAlphaBits options. The default number of bits are 4 and 1
respectively. Allowed values for <var>N</var> are 1, 2, or 4.
</p>
</dd>
<dt><code>-d<var>device</var></code></dt>
<dd><p>The available output format is specified by the option <var>device</var>, and
is one of:
</p>
<dl compact="compact">
<dt><code>ps</code></dt>
<dt><code>ps2</code></dt>
<dt><code>psc</code></dt>
<dt><code>psc2</code></dt>
<dd><p>PostScript (level 1 and 2, mono and color). The OpenGL-based toolkits
always generate PostScript level 3.0.
</p>
</dd>
<dt><code>eps</code></dt>
<dt><code>eps2</code></dt>
<dt><code>epsc</code></dt>
<dt><code>epsc2</code></dt>
<dd><p>Encapsulated PostScript (level 1 and 2, mono and color). The
OpenGL-based toolkits always generate PostScript level 3.0.
</p>
</dd>
<dt><code>pslatex</code></dt>
<dt><code>epslatex</code></dt>
<dt><code>pdflatex</code></dt>
<dt><code>pslatexstandalone</code></dt>
<dt><code>epslatexstandalone</code></dt>
<dt><code>pdflatexstandalone</code></dt>
<dd><p>Generate a LaTeX file <samp><var>filename</var>.tex</samp> for the text
portions of a plot and a file <samp><var>filename</var>.(ps|eps|pdf)</samp> for the
remaining graphics. The graphics file suffix .ps|eps|pdf is determined
by the specified device type. The LaTeX file produced by the
‘<samp>standalone</samp>’ option can be processed directly by LaTeX. The file
generated without the ‘<samp>standalone</samp>’ option is intended to be included
from another LaTeX document. In either case, the LaTeX file
contains an <code>\includegraphics</code> command so that the generated graphics
file is automatically included when the LaTeX file is processed. The
text that is written to the LaTeX file contains the strings
<strong>exactly</strong> as they were specified in the plot. If any special
characters of the TeX mode interpreter were used, the file must be
edited before LaTeX processing. Specifically, the special characters
must be enclosed with dollar signs (<code>$ … $</code>), and other
characters that are recognized by LaTeX may also need editing (.e.g.,
braces). The ‘<samp>pdflatex</samp>’ device, and any of the ‘<samp>standalone</samp>’
formats, are not available with the Gnuplot toolkit.
</p>
</dd>
<dt><code>epscairo</code></dt>
<dt><code>pdfcairo</code></dt>
<dt><code>epscairolatex</code></dt>
<dt><code>pdfcairolatex</code></dt>
<dt><code>epscairolatexstandalone</code></dt>
<dt><code>pdfcairolatexstandalone</code></dt>
<dd><p>Generate Cairo based output when using the Gnuplot graphics toolkit.
The ‘<samp>epscairo</samp>’ and ‘<samp>pdfcairo</samp>’ devices are synonymous with
the ‘<samp>epsc</samp>’ device. The LaTeX variants generate a LaTeX file,
<samp><var>filename</var>.tex</samp>, for the text portions of a plot, and an image
file, <samp><var>filename</var>.(eps|pdf)</samp>, for the graph portion of the plot.
The ‘<samp>standalone</samp>’ variants behave as described for
‘<samp>epslatexstandalone</samp>’ above.
</p>
</dd>
<dt><code>ill</code></dt>
<dt><code>aifm</code></dt>
<dd><p>Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
</p>
</dd>
<dt><code>canvas</code></dt>
<dd><p>Javascript-based drawing on HTML5 canvas viewable in a web browser
(only available for the Gnuplot graphics toolkit).
</p>
</dd>
<dt><code>cdr</code></dt>
<dt><code>corel</code></dt>
<dd><p>CorelDraw
</p>
</dd>
<dt><code>dxf</code></dt>
<dd><p>AutoCAD
</p>
</dd>
<dt><code>emf</code></dt>
<dt><code>meta</code></dt>
<dd><p>Microsoft Enhanced Metafile
</p>
</dd>
<dt><code>fig</code></dt>
<dd><p>XFig. For the Gnuplot graphics toolkit, the additional options
<samp>-textspecial</samp> or <samp>-textnormal</samp> can be used to control
whether the special flag should be set for the text in the figure.
(default is <samp>-textnormal</samp>)
</p>
</dd>
<dt><code>gif</code></dt>
<dd><p>GIF image (only available for the Gnuplot graphics toolkit)
</p>
</dd>
<dt><code>hpgl</code></dt>
<dd><p>HP plotter language
</p>
</dd>
<dt><code>jpg</code></dt>
<dt><code>jpeg</code></dt>
<dd><p>JPEG image
</p>
</dd>
<dt><code>latex</code></dt>
<dd><p>LaTeX picture environment (only available for the Gnuplot graphics
toolkit).
</p>
</dd>
<dt><code>mf</code></dt>
<dd><p>Metafont
</p>
</dd>
<dt><code>png</code></dt>
<dd><p>Portable network graphics
</p>
</dd>
<dt><code>pbm</code></dt>
<dd><p>PBMplus
</p>
</dd>
<dt><code>pdf</code></dt>
<dd><p>Portable document format
</p></dd>
</dl>
</dd>
<dt><code>svg</code></dt>
<dd><p>Scalable vector graphics
</p>
</dd>
<dt><code>tikz</code></dt>
<dt><code>tikzstandalone</code></dt>
<dd><p>Generate a LaTeX file using PGF/TikZ format. The OpenGL-based
toolkits create a PGF file while Gnuplot creates a TikZ file. The
‘<samp>tikzstandalone</samp>’ device produces a LaTeX document which includes the
TikZ file (‘<samp>tikzstandalone</samp>’ and is only available for the Gnuplot
graphics toolkit).
</p>
<p>If the device is omitted, it is inferred from the file extension,
or if there is no filename it is sent to the printer as PostScript.
</p>
</dd>
<dt><code>-d<var>ghostscript_device</var></code></dt>
<dd><p>Additional devices are supported by Ghostscript.
Some examples are;
</p>
<dl compact="compact">
<dt><code>pdfwrite</code></dt>
<dd><p>Produces pdf output from eps
</p>
</dd>
<dt><code>ljet2p</code></dt>
<dd><p>HP LaserJet IIP
</p>
</dd>
<dt><code>pcx24b</code></dt>
<dd><p>24-bit color PCX file format
</p>
</dd>
<dt><code>ppm</code></dt>
<dd><p>Portable Pixel Map file format
</p></dd>
</dl>
<p>For a complete list, type <code>system ("gs -h")</code> to see what formats
and devices are available.
</p>
<p>When Ghostscript output is sent to a printer the size is determined by
the figure’s <code>"papersize"</code> property. When the output is sent to a
file the size is determined by the plot box defined by the figure’s
<code>"paperposition"</code> property.
</p>
</dd>
<dt><code>-append</code></dt>
<dd><p>Append PostScript or PDF output to a pre-existing file of the same type.
</p>
</dd>
<dt><code>-r<var>NUM</var></code></dt>
<dd><p>Resolution of bitmaps in pixels per inch. For both metafiles and SVG
the default is the screen resolution; for other formats it is 150 dpi. To
specify screen resolution, use <code>"-r0"</code>.
</p>
</dd>
<dt><code>-loose</code></dt>
<dt><code>-tight</code></dt>
<dd><p>Force a tight or loose bounding box for eps files. The default is loose.
</p>
</dd>
<dt><code>-<var>preview</var></code></dt>
<dd><p>Add a preview to eps files. Supported formats are:
</p>
<dl compact="compact">
<dt><code>-interchange</code></dt>
<dd><p>Provide an interchange preview.
</p>
</dd>
<dt><code>-metafile</code></dt>
<dd><p>Provide a metafile preview.
</p>
</dd>
<dt><code>-pict</code></dt>
<dd><p>Provide pict preview.
</p>
</dd>
<dt><code>-tiff</code></dt>
<dd><p>Provide a tiff preview.
</p></dd>
</dl>
</dd>
<dt><code>-S<var>xsize</var>,<var>ysize</var></code></dt>
<dd><p>Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG.
For PS, EPS, PDF, and other vector formats the plot size is in points.
This option is equivalent to changing the size of the plot box associated
with the <code>"paperposition"</code> property. When using the command form of
the print function you must quote the <var>xsize</var>,<var>ysize</var> option. For
example, by writing <span class="nolinebreak">"-S640,480"</span><!-- /@w -->.
</p>
</dd>
<dt><code>-F<var>fontname</var></code></dt>
<dt><code>-F<var>fontname</var>:<var>size</var></code></dt>
<dt><code>-F:<var>size</var></code></dt>
<dd><p>Use <var>fontname</var> and/or <var>fontsize</var> for all text.
<var>fontname</var> is ignored for some devices: dxf, fig, hpgl, etc.
</p></dd>
</dl>
<p>The filename and options can be given in any order.
</p>
<p>Example: Print to a file using the pdf device.
</p>
<div class="example">
<pre class="example">figure (1);
clf ();
surf (peaks);
print figure1.pdf
</pre></div>
<p>Example: Print to a file using jpg device.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
print -djpg figure2.jpg
</pre></div>
<p>Example: Print to printer named PS_printer using ps format.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
print -dpswrite -PPS_printer
</pre></div>
<p><strong>See also:</strong> <a href="#XREFsaveas">saveas</a>, <a href="#XREFhgsave">hgsave</a>, <a href="#XREForient">orient</a>, <a href="Multiple-Plot-Windows.html#XREFfigure">figure</a>.
</p></dd></dl>
<a name="XREFsaveas"></a><dl>
<dt><a name="index-saveas"></a>: <em></em> <strong>saveas</strong> <em>(<var>h</var>, <var>filename</var>)</em></dt>
<dt><a name="index-saveas-1"></a>: <em></em> <strong>saveas</strong> <em>(<var>h</var>, <var>filename</var>, <var>fmt</var>)</em></dt>
<dd><p>Save graphic object <var>h</var> to the file <var>filename</var> in graphic format
<var>fmt</var>.
</p>
<p><var>fmt</var> should be one of the following formats:
</p>
<dl compact="compact">
<dt><code>ps</code></dt>
<dd><p>PostScript
</p>
</dd>
<dt><code>eps</code></dt>
<dd><p>Encapsulated PostScript
</p>
</dd>
<dt><code>jpg</code></dt>
<dd><p>JPEG Image
</p>
</dd>
<dt><code>png</code></dt>
<dd><p>PNG Image
</p>
</dd>
<dt><code>emf</code></dt>
<dd><p>Enhanced Meta File
</p>
</dd>
<dt><code>pdf</code></dt>
<dd><p>Portable Document Format
</p></dd>
</dl>
<p>All device formats specified in <code>print</code> may also be used. If
<var>fmt</var> is omitted it is extracted from the extension of <var>filename</var>.
The default format is <code>"pdf"</code>.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
saveas (1, "figure1.png");
</pre></div>
<p><strong>See also:</strong> <a href="#XREFprint">print</a>, <a href="#XREFhgsave">hgsave</a>, <a href="#XREForient">orient</a>.
</p></dd></dl>
<a name="XREForient"></a><dl>
<dt><a name="index-orient"></a>: <em></em> <strong>orient</strong> <em>(<var>orientation</var>)</em></dt>
<dt><a name="index-orient-1"></a>: <em></em> <strong>orient</strong> <em>(<var>hfig</var>, <var>orientation</var>)</em></dt>
<dt><a name="index-orient-2"></a>: <em><var>orientation</var> =</em> <strong>orient</strong> <em>()</em></dt>
<dt><a name="index-orient-3"></a>: <em><var>orientation</var> =</em> <strong>orient</strong> <em>(<var>hfig</var>)</em></dt>
<dd><p>Query or set the print orientation for figure <var>hfig</var>.
</p>
<p>Valid values for <var>orientation</var> are <code>"portrait"</code>,
<code>"landscape"</code>, and <code>"tall"</code>.
</p>
<p>The <code>"landscape"</code> option changes the orientation so the plot width
is larger than the plot height. The <code>"paperposition"</code> is also
modified so that the plot fills the page, while leaving a 0.25 inch border.
</p>
<p>The <code>"tall"</code> option sets the orientation to <code>"portrait"</code> and
fills the page with the plot, while leaving a 0.25 inch border.
</p>
<p>The <code>"portrait"</code> option (default) changes the orientation so the plot
height is larger than the plot width. It also restores the default
<code>"paperposition"</code> property.
</p>
<p>When called with no arguments, return the current print orientation.
</p>
<p>If the argument <var>hfig</var> is omitted, then operate on the current figure
returned by <code>gcf</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFprint">print</a>, <a href="#XREFsaveas">saveas</a>.
</p></dd></dl>
<p><code>print</code> and <code>saveas</code> are used when work on a plot has finished
and the output must be in a publication-ready format. During intermediate
stages it is often better to save the graphics object and all of its
associated information so that changes—to colors, axis limits, marker styles,
etc.—can be made easily from within Octave. The <code>hgsave</code>/<code>hgload</code>
commands can be used to save and re-create a graphics object.
</p>
<a name="XREFhgsave"></a><dl>
<dt><a name="index-hgsave"></a>: <em></em> <strong>hgsave</strong> <em>(<var>filename</var>)</em></dt>
<dt><a name="index-hgsave-1"></a>: <em></em> <strong>hgsave</strong> <em>(<var>h</var>, <var>filename</var>)</em></dt>
<dt><a name="index-hgsave-2"></a>: <em></em> <strong>hgsave</strong> <em>(<var>h</var>, <var>filename</var>, <var>fmt</var>)</em></dt>
<dd><p>Save the graphics handle <var>h</var> to the file <var>filename</var> in the format
<var>fmt</var>.
</p>
<p>If unspecified, <var>h</var> is the current figure as returned by <code>gcf</code>.
</p>
<p>When <var>filename</var> does not have an extension the default filename
extension <samp>.ofig</samp> will be appended.
</p>
<p>If present, <var>fmt</var> should be one of the following:
</p>
<ul>
<li> <samp>-binary</samp>, <samp>-float-binary</samp>
</li><li> <samp>-hdf5</samp>, <samp>-float-hdf5</samp>
</li><li> <samp>-V7</samp>, <samp>-v7</samp>, <code>-7</code>, <samp>-mat7-binary</samp>
</li><li> <samp>-V6</samp>, <samp>-v6</samp>, <code>-6</code>, <samp>-mat6-binary</samp>
</li><li> <samp>-text</samp>
</li><li> <samp>-zip</samp>, <samp>-z</samp>
</li></ul>
<p>When producing graphics for final publication use <code>print</code> or
<code>saveas</code>. When it is important to be able to continue to edit a
figure as an Octave object, use <code>hgsave</code>/<code>hgload</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFhgload">hgload</a>, <a href="Graphics-Objects.html#XREFhdl2struct">hdl2struct</a>, <a href="#XREFsaveas">saveas</a>, <a href="#XREFprint">print</a>.
</p></dd></dl>
<a name="XREFhgload"></a><dl>
<dt><a name="index-hgload"></a>: <em><var>h</var> =</em> <strong>hgload</strong> <em>(<var>filename</var>)</em></dt>
<dd><p>Load the graphics object in <var>filename</var> into the graphics handle <var>h</var>.
</p>
<p>If <var>filename</var> has no extension, Octave will try to find the file with
and without the standard extension of <samp>.ofig</samp>.
</p>
<p><strong>See also:</strong> <a href="#XREFhgsave">hgsave</a>, <a href="Graphics-Objects.html#XREFstruct2hdl">struct2hdl</a>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Interacting-with-Plots.html#Interacting-with-Plots" accesskey="n" rel="next">Interacting with Plots</a>, Previous: <a href="Use-of-the-interpreter-Property.html#Use-of-the-interpreter-Property" accesskey="p" rel="prev">Use of the <code>interpreter</code> Property</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>
|