File: Printing-and-Saving-Plots.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (748 lines) | stat: -rw-r--r-- 31,432 bytes parent folder | download
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, 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 (version 6.2.0))</title>

<meta name="description" content="Printing and Saving Plots (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Printing and Saving Plots (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="High_002dLevel-Plotting.html" rel="up" title="High-Level Plotting">
<link href="Interacting-with-Plots.html" rel="next" title="Interacting with Plots">
<link href="Use-of-the-interpreter-Property.html" rel="prev" title="Use of the interpreter Property">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {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}
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">
<span id="Printing-and-Saving-Plots"></span><div class="header">
<p>
Next: <a href="Interacting-with-Plots.html" accesskey="n" rel="next">Interacting with Plots</a>, Previous: <a href="Use-of-the-interpreter-Property.html" accesskey="p" rel="prev">Use of the <code>interpreter</code> Property</a>, Up: <a href="High_002dLevel-Plotting.html" accesskey="u" rel="up">High-Level Plotting</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Printing-and-Saving-Plots-1"></span><h4 class="subsection">15.2.9 Printing and Saving Plots</h4>
<span id="index-plotting_002c-saving-and-printing-plots"></span>
<span id="index-printing-plots"></span>
<span id="index-saving-plots"></span>

<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 unusual text and in their ability to print
such text.  In general, the <code>&quot;tex&quot;</code> interpreter (default) is the best
all-around performer for both on-screen display and printing.  However, for the
reproduction of complicated text formulas the <code>&quot;latex&quot;</code> interpreter is
preferred.  The <code>&quot;latex&quot;</code> interpreter will not display symbols on-screen,
but the printed output will be correct.  When printing, use one of the
<code>standalone</code> options which provide full access to 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, &quot;r&quot;);
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$'],
      &quot;interpreter&quot;, &quot;latex&quot;);
xlabel (&quot;x&quot;);
ylabel (&quot;erf (x)&quot;);
title (&quot;erf (x) with text annotation&quot;);
print (hf, &quot;plot15_7&quot;, &quot;-dpdflatexstandalone&quot;);
system (&quot;pdflatex plot15_7&quot;);
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"><span id="fig_003aextendedtext"></span>
<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>
<span id="XREFprint"></span><dl>
<dt id="index-print">: <em></em> <strong>print</strong> <em>()</em></dt>
<dt id="index-print-1">: <em></em> <strong>print</strong> <em>(<var>options</var>)</em></dt>
<dt id="index-print-2">: <em></em> <strong>print</strong> <em>(<var>filename</var>, <var>options</var>)</em></dt>
<dt id="index-print-3">: <em></em> <strong>print</strong> <em>(<var>hfig</var>, &hellip;)</em></dt>
<dt id="index-print-4">: <em><var>rgb</var> =</em> <strong>print</strong> <em>(<code>&quot;-RGBImage&quot;</code>, &hellip;)</em></dt>
<dd><p>Format a figure for printing and either save it to a file, send it to a
printer, or return an RGB image.
</p>
<p><var>filename</var> defines the name of the output file.  If the filename has
no suffix then one is inferred from the specified device and appended to the
filename.  When neither a filename nor the <code>&quot;-RGBImage&quot;</code> option is
present, the output is sent to the printer.  The various options and
filename arguments may be given in any order, except for the figure handle
argument <var>hfig</var> which must be first if it is present.
</p>
<p>Example: Print to a file using PDF and JPEG formats.
</p>
<div class="example">
<pre class="example">figure (1);
clf ();
surf (peaks);
print figure1.pdf    # The extension specifies the format
print -djpg figure1  # Will produce &quot;figure1.jpg&quot; file
</pre></div>

<p>If the first argument is a handle <var>hfig</var> to a figure object then it
specifies the figure to print.  By default, the current figure returned
by <code>gcf</code> is printed.
</p>
<p>For outputs to paged formats, for example, PostScript and PDF, the page size
is specified by the figure&rsquo;s <code>papersize</code> property together with the
<code>paperunits</code> property.  The location and size of the plot on the page
are specified by the figure&rsquo;s <code>paperposition</code> property.  The
orientation of the page is specified by the figure&rsquo;s <code>paperorientation</code>
property.
</p>
<p>For non-page formats&mdash;for example, image formats like JPEG&mdash;the width and
height of the output are specified by the figure&rsquo;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.
</p>
<p>Example: Print figure 1.
</p>
<div class="example">
<pre class="example">figure (1);
clf ();
surf (peaks);
figure (2);
print -f1 figure1.pdf
## Equivalent functional form:
print (1, &quot;figure1.pdf&quot;)
</pre></div>

</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>
<p>Example: Print to printer named PS_printer using PostScript format.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
print -dpswrite -PPS_printer
</pre></div>

</dd>
<dt><code>-RGBImage</code></dt>
<dd><p>Return an M-by-N-by-3 RGB image of the figure.  The size of the image
depends on the formatting options.  This is similar to taking a screen
capture of the plot, but formatting options may be changed such as the
resolution or monochrome/color.
</p>
<p>Example: Get the pixels of a figure image.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
<var>rgb</var> = print (&quot;-RGBImage&quot;);
</pre></div>

</dd>
<dt><code>-opengl</code></dt>
<dt><code>-painters</code></dt>
<dd><p>Specifies whether the opengl (pixel-based) or painters (vector-based)
renderer is used.  This is equivalent to changing the figure&rsquo;s
<code>&quot;Renderer&quot;</code> property.  When the figure <code>&quot;RendererMode&quot;</code>
property is <code>&quot;auto&quot;</code> (the default) Octave will use the
<code>&quot;opengl&quot;</code> renderer for raster formats (e.g., JPEG) and
<code>&quot;painters&quot;</code> for vector formats (e.g., PDF).  Those options are only
supported for the &quot;qt&quot; graphics toolkit.
</p>
</dd>
<dt><code>-svgconvert</code></dt>
<dd><p>When using the <samp>-painters</samp> renderer, this enables a different
backend toolchain with enhanced characteristics:
</p>
<dl compact="compact">
<dt>Font handling:</dt>
<dd><p>The actual font is embedded in the output file which allows for printing
arbitrary characters and fonts in all vector formats.
</p>
</dd>
<dt>Output Simplification:</dt>
<dd><p>By default, the option <samp>-painters</samp> renders patch and surface objects
using assemblies of triangles.  This may lead to anti-aliasing artifacts
when viewing the file.  The <samp>-svgconvert</samp> option reconstructs
polygons in order to avoid those artifacts (particularly for 2-D figures).
</p>
</dd>
<dt>Transparency:</dt>
<dd><p>Allows for printing transparent graphics objects in PDF format.
For PostScript formats the presence of any transparent object will cause the
output to be rasterized.
</p></dd>
</dl>

<p>Caution: <samp>-svgconvert</samp> may lead to inaccurate rendering of image
objects.
</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>&quot;paperposition&quot;</code> property in the
orientation specified.  This option is equivalent to changing the figure&rsquo;s
<code>&quot;paperorientation&quot;</code> property.
</p>
</dd>
<dt><code>-fillpage</code></dt>
<dt><code>-bestfit</code></dt>
<dd><p>When using a page-based format (PDF, PostScript, printer) ignore the
<code>&quot;paperposition&quot;</code> property and have the plot occupy the entire page.
The option <samp>-fillpage</samp> will stretch the plot to occupy the page with
0.25 inch margins all around.  The option <samp>-bestfit</samp> will expand the
plot to take up as much room as possible on the page <strong>without</strong>
distorting the original aspect ratio of the plot.
</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>-noui</code></dt>
<dd><p>Don&rsquo;t print uicontrol objects such as pushbuttons which may overlay the
plot.  This is the default behavior and it is not possible to include
uicontrol objects in the output without using an external screen capture
tool.
</p>
</dd>
<dt><code>-r<var>NUM</var></code></dt>
<dd><p>Resolution of bitmaps in dots per inch (DPI).  For both metafiles and SVG
the default is the screen resolution; for other formats the default is 150
DPI.  To specify screen resolution, use <code>&quot;-r0&quot;</code>.
</p>
<p>Example: high resolution raster output.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks (), &quot;facelighting&quot;, &quot;gouraud&quot;);
light ();
print (&quot;-r600&quot;, &quot;lit_peaks.png&quot;);
</pre></div>

</dd>
<dt><code>-S<var>xsize</var>,<var>ysize</var></code></dt>
<dd><p>Plot size in pixels for raster formats including PNG, JPEG, PNG, and
<em>unusually</em> SVG.  For all vector formats, including PDF, PS, and EPS,
the plot size is specified in points.  This option is equivalent to changing
the width and height of the output by setting the figure property
<code>paperposition(3:4)</code>.  When using the command form of the print
function you must quote the <var>xsize</var>,<var>ysize</var> option to prevent the
Octave interpreter from recognizing the embedded comma (&rsquo;,&rsquo;).  For example,
by writing <span class="nolinebreak">&quot;-S640,480&quot;</span><!-- /@w -->.
</p>
</dd>
<dt><code>-tight</code></dt>
<dt><code>-loose</code></dt>
<dd><p>Force a tight or loose bounding box for EPS files.  The default is tight.
</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 a pict preview.
</p>
</dd>
<dt><code>-tiff</code></dt>
<dd><p>Provide a TIFF preview.
</p></dd>
</dl>

</dd>
<dt><code>-append</code></dt>
<dd><p>Append PostScript or PDF output to an existing file of the same type.
</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: fig, etc.
</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 the following (devices marked with a <code>'*'</code> are only
available with the Gnuplot toolkit):
</p>
<p>Vector Formats
</p>
<dl compact="compact">
<dt><code>svg</code></dt>
<dd><p>Scalable Vector Graphics.
</p>
</dd>
<dt><code>pdf</code></dt>
<dt><code>pdfcrop</code></dt>
<dd><p>Portable Document Format.  The <code>pdf</code> device formats the figure for
printing on paper.  The size of the surrounding page and the position of the
figure inside the page are defined by the
<a href="Figure-Properties.html#XREFfigurepaperorientation">paper* figure properties</a>.
</p>
<p>Use <code>pdfcrop</code> if you don&rsquo;t want the surrounding page.
</p>
<p>By default, PDF inherits the same limitations as PostScript.
For an enhanced output with complete text support and basic transparency,
use the <samp>-svgconvert</samp> option.
</p>
</dd>
<dt><code>eps(2)</code></dt>
<dt><code>epsc(2)</code></dt>
<dd><p>Encapsulated PostScript (level 1 and 2, mono and color).
</p>
<p>The OpenGL-based graphics toolkits always generate PostScript level 3.0.
They have limited support for text unless using the <samp>-svgconvert</samp>
option.
Limitations include using only ASCII characters (e.g., no Greek letters)
and support for just three base PostScript fonts: Helvetica (the default),
Times, or Courier.  Any other font will be replaced by Helvetica.
</p>
</dd>
<dt><code>ps(2)</code></dt>
<dt><code>psc(2)</code></dt>
<dd><p>Same as <code>eps</code> except that the figure is formatted for printing on
paper.  The size of the surrounding page and position of the figure inside
the page are defined by the
<a href="Figure-Properties.html#XREFfigurepaperorientation">paper* figure properties</a>.
</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 &lsquo;<samp>standalone</samp>&rsquo;
option can be processed directly by LaTeX.  The file generated without
the &lsquo;<samp>standalone</samp>&rsquo; 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>$&nbsp;&hellip;&nbsp;$</code>)<!-- /@w -->, and other characters that are
recognized by LaTeX may also need editing (e.g., braces).  The
&lsquo;<samp>pdflatex</samp>&rsquo; device, and any of the &lsquo;<samp>standalone</samp>&rsquo; 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 output with Cairo renderer.  The devices <code>epscairo</code> and
<code>pdfcairo</code> are synonymous with the <code>epsc</code> 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 &lsquo;<samp>standalone</samp>&rsquo; variants behave as
described for &lsquo;<samp>epslatexstandalone</samp>&rsquo; above.
</p>
</dd>
<dt><code>canvas*</code></dt>
<dd><p>Javascript-based drawing on an HTML5 canvas viewable in a web browser.
</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> (default) can be used to
control whether the special flag should be set for the text in the figure.
</p>
</dd>
<dt><code>latex*</code></dt>
<dt><code>eepic*</code></dt>
<dd><p>LaTeX picture environment and extended picture environment.
</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
&lsquo;<samp>tikzstandalone</samp>&rsquo; device produces a LaTeX document which includes the
TikZ file.
</p>
</dd>
</dl>

<p>Raster Formats
</p>
<dl compact="compact">
<dt><code>png</code></dt>
<dd><p>Portable Network Graphics
</p>
</dd>
<dt><code>jpg</code></dt>
<dt><code>jpeg</code></dt>
<dd><p>JPEG image
</p>
</dd>
<dt><code>tif</code></dt>
<dt><code>tiff</code></dt>
<dt><code>tiffn</code></dt>
<dd><p>TIFF image with LZW compression (tif, tiff) or uncompressed
(tiffn).
</p>
</dd>
<dt><code>gif</code></dt>
<dd><p>GIF image
</p>
</dd>
<dt><code>pbm</code></dt>
<dd><p>PBMplus
</p>
</dd>
<dt><code>dumb*</code></dt>
<dd><p>ASCII art
</p>
</dd>
</dl>

<p>If the device is omitted, it is inferred from the file extension,
or if there is no filename then 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>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 of available formats and devices type
<kbd>system (&quot;gs -h&quot;)</kbd>.
</p>
<p>When Ghostscript output is sent to a printer the size is determined by
the figure&rsquo;s <code>&quot;papersize&quot;</code> property.  When the output is sent to a
file the size is determined by the plot box defined by the figure&rsquo;s
<code>&quot;paperposition&quot;</code> property.
</p>
</dd>
<dt><code>-G<var>ghostscript_command</var></code></dt>
<dd><p>Specify the command for calling Ghostscript.  For Unix the default is
<code>&quot;gs&quot;</code> and for Windows it is <code>&quot;gswin32c&quot;</code>.
</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&rsquo;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>
</dl>


<p><strong>See also:</strong> <a href="#XREFsaveas">saveas</a>, <a href="Representing-Images.html#XREFgetframe">getframe</a>, <a href="#XREFsavefig">savefig</a>, <a href="#XREFhgsave">hgsave</a>, <a href="#XREForient">orient</a>, <a href="Multiple-Plot-Windows.html#XREFfigure">figure</a>.
</p></dd></dl>


<span id="XREFsaveas"></span><dl>
<dt id="index-saveas">: <em></em> <strong>saveas</strong> <em>(<var>h</var>, <var>filename</var>)</em></dt>
<dt id="index-saveas-1">: <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>All device formats accepted by <code>print</code> may be used.  Common formats
are:
</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>pdf</code></dt>
<dd><p>Portable Document Format
</p>
</dd>
<dt><code>jpg</code></dt>
<dd><p>JPEG Image
</p>
</dd>
<dt><code>png</code></dt>
<dd><p>Portable Network Graphics image
</p>
</dd>
<dt><code>emf</code></dt>
<dd><p>Enhanced MetaFile
</p>
</dd>
<dt><code>tif</code></dt>
<dd><p>TIFF Image, compressed
</p>
</dd>
</dl>

<p>If <var>fmt</var> is omitted it is extracted from the extension of
<var>filename</var>.  The default format when there is no extension is
<code>&quot;pdf&quot;</code>.
</p>
<div class="example">
<pre class="example">clf ();
surf (peaks);
saveas (1, &quot;figure1.png&quot;);
</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>


<span id="XREForient"></span><dl>
<dt id="index-orient">: <em></em> <strong>orient</strong> <em>(<var>orientation</var>)</em></dt>
<dt id="index-orient-1">: <em></em> <strong>orient</strong> <em>(<var>hfig</var>, <var>orientation</var>)</em></dt>
<dt id="index-orient-2">: <em><var>orientation</var> =</em> <strong>orient</strong> <em>()</em></dt>
<dt id="index-orient-3">: <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>&quot;portrait&quot;</code>,
<code>&quot;landscape&quot;</code>, and <code>&quot;tall&quot;</code>.
</p>
<p>The <code>&quot;landscape&quot;</code> option changes the orientation so the plot width
is larger than the plot height.  The <code>&quot;paperposition&quot;</code> is also
modified so that the plot fills the page, while leaving a 0.25 inch border.
</p>
<p>The <code>&quot;tall&quot;</code> option sets the orientation to <code>&quot;portrait&quot;</code> and
fills the page with the plot, while leaving a 0.25 inch border.
</p>
<p>The <code>&quot;portrait&quot;</code> option (default) changes the orientation so the plot
height is larger than the plot width.  It also restores the default
<code>&quot;paperposition&quot;</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&mdash;to colors, axis limits, marker styles,
etc.&mdash;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>
<span id="XREFhgsave"></span><dl>
<dt id="index-hgsave">: <em></em> <strong>hgsave</strong> <em>(<var>filename</var>)</em></dt>
<dt id="index-hgsave-1">: <em></em> <strong>hgsave</strong> <em>(<var>h</var>, <var>filename</var>)</em></dt>
<dt id="index-hgsave-2">: <em></em> <strong>hgsave</strong> <em>(<var>h</var>, <var>filename</var>, <var>fmt</var>)</em></dt>
<dd><p>Save the graphics handle(s) <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> must 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>, <samp>-7</samp>, <samp>-mat7-binary</samp>

</li><li> <samp>-V6</samp>, <samp>-v6</samp>, <samp>-6</samp>, <samp>-mat6-binary</samp>

</li><li> <samp>-text</samp>

</li><li> <samp>-zip</samp>, <samp>-z</samp>
</li></ul>

<p>The default format is <samp>-binary</samp> to minimize storage.
</p>
<p>Programming Note: 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="#XREFsavefig">savefig</a>, <a href="#XREFsaveas">saveas</a>, <a href="#XREFprint">print</a>.
</p></dd></dl>


<span id="XREFhgload"></span><dl>
<dt id="index-hgload">: <em><var>h</var> =</em> <strong>hgload</strong> <em>(<var>filename</var>)</em></dt>
<dt id="index-hgload-1">: <em>[<var>h</var>, <var>old_prop</var>] =</em> <strong>hgload</strong> <em>(<var>filename</var>, <var>prop_struct</var>)</em></dt>
<dd><p>Load the graphics objects in <var>filename</var> into a vector of graphics
handles <var>h</var>.
</p>
<p>If <var>filename</var> has no extension, Octave will try to find the file with
and without the default extension <samp>.ofig</samp>.
</p>
<p>If provided, the elements of structure <var>prop_struct</var> will be used to
override the properties of top-level objects stored in <var>filename</var>, and
the saved values from <var>filename</var> will be stored in <var>old_prop</var>.
<var>old_prop</var> is a cell array matching the size of <var>h</var>; each cell
contains a structure of the existing property names and values before being
overridden.
</p>

<p><strong>See also:</strong> <a href="#XREFopenfig">openfig</a>, <a href="#XREFhgsave">hgsave</a>, <a href="Graphics-Objects.html#XREFstruct2hdl">struct2hdl</a>.
</p></dd></dl>


<span id="XREFopenfig"></span><dl>
<dt id="index-openfig">: <em></em> <strong>openfig</strong></dt>
<dt id="index-openfig-1">: <em></em> <strong>openfig</strong> <em>(<var>filename</var>)</em></dt>
<dt id="index-openfig-2">: <em></em> <strong>openfig</strong> <em>(&hellip;, <var>copies</var>)</em></dt>
<dt id="index-openfig-3">: <em></em> <strong>openfig</strong> <em>(&hellip;, <var>visibility</var>)</em></dt>
<dt id="index-openfig-4">: <em><var>h</var> =</em> <strong>openfig</strong> <em>(&hellip;)</em></dt>
<dd><p>Read saved figure window(s) from <var>filename</var> and return graphics
handle(s) <var>h</var>.
</p>
<p>By default, <var>filename</var> is <code>&quot;Untitled.fig&quot;</code>.  If a full path is not
specified, the file opened will be the first one encountered in the load
path.  If <var>filename</var> is not found and does not have an extension, a
search will take place for the first file in the load path with extension
<code>&quot;.fig&quot;</code> or <code>&quot;.ofig&quot;</code>, in that order.
</p>
<p><var>copies</var> is an optional input indicating whether a new figure should
be created (<code>&quot;new&quot;</code>) or whether an existing figure may be reused
(<code>&quot;reuse&quot;</code>).  An existing figure may be reused if the
<code>&quot;FileName&quot;</code> property matches the specified input <var>filename</var>.
When a figure is reused it becomes the active figure and is shown on top
of other figures.  If the figure was offscreen, it is re-positioned to be
onscreen.  The default value for <var>copies</var> is <code>&quot;new&quot;</code>.
</p>
<p><var>visibility</var> is an optional input indicating whether to show the figure
(<code>&quot;visible&quot;</code>) or not (<code>&quot;invisible&quot;</code>).  When <var>visibility</var> is
specified as an input to <code>openfig</code> it overrides the visibility setting
stored in <var>filename</var>.
</p>

<p><strong>See also:</strong> <a href="Controlling-Subprocesses.html#XREFopen">open</a>, <a href="#XREFhgload">hgload</a>, <a href="#XREFsavefig">savefig</a>, <a href="Graphics-Objects.html#XREFstruct2hdl">struct2hdl</a>.
</p></dd></dl>


<span id="XREFsavefig"></span><dl>
<dt id="index-savefig">: <em></em> <strong>savefig</strong> <em>()</em></dt>
<dt id="index-savefig-1">: <em></em> <strong>savefig</strong> <em>(<var>h</var>)</em></dt>
<dt id="index-savefig-2">: <em></em> <strong>savefig</strong> <em>(<var>filename</var>)</em></dt>
<dt id="index-savefig-3">: <em></em> <strong>savefig</strong> <em>(<var>h</var>, <var>filename</var>)</em></dt>
<dt id="index-savefig-4">: <em></em> <strong>savefig</strong> <em>(<var>h</var>, <var>filename</var>, <code>&quot;compact&quot;</code>)</em></dt>
<dd><p>Save figure windows specified by graphics handle(s) <var>h</var> to file
<var>filename</var>.
</p>
<p>If unspecified, <var>h</var> is the current figure returned by <code>gcf</code>.
</p>
<p>If unspecified, <var>filename</var> is set to <samp>&quot;Untitled.fig&quot;</samp>.  If
<var>filename</var> does not have an extension then the default extension
<samp>&quot;.fig&quot;</samp> will be added.
</p>
<p>If the optional third input <code>&quot;compact&quot;</code> is present then the data
will be compressed to save more space.
</p>

<p><strong>See also:</strong> <a href="#XREFhgsave">hgsave</a>, <a href="Graphics-Objects.html#XREFhdl2struct">hdl2struct</a>, <a href="#XREFopenfig">openfig</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Interacting-with-Plots.html" accesskey="n" rel="next">Interacting with Plots</a>, Previous: <a href="Use-of-the-interpreter-Property.html" accesskey="p" rel="prev">Use of the <code>interpreter</code> Property</a>, Up: <a href="High_002dLevel-Plotting.html" accesskey="u" rel="up">High-Level Plotting</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>