Print a plot, or save it to a file.
Both output formatted for printing (PDF and PostScript), and many bitmapped and vector image formats are supported.
filename 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.
h specifies the handle of the figure to print. If no handle is specified the current figure is used.
For output to a printer, PostScript file, or PDF file, the paper size is
specified by the figure’s papersize property. The location and
size of the image on the page are specified by the figure’s
paperposition property. The orientation of the page is specified
by the figure’s paperorientation property.
The width and height of images are specified by the figure’s
paperpositon(3:4) property values.
The print command supports many options:
-fhSpecify the handle, h, of the figure to be printed. The default is the current figure.
-PprinterSet the printer name to which the plot is sent if no filename is specified.
-Gghostscript_commandSpecify the command for calling Ghostscript. For Unix and Windows the
defaults are "gs" and "gswin32c", respectively.
-color-monoColor or monochrome output.
-solid-dashedForce all lines to be solid or dashed, respectively.
-portrait-landscapeSpecify 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 "paperposition" property in the
orientation specified. This option is equivalent to changing the figure’s
"paperorientation" property.
-TextAlphaBits=n-GraphicsAlphaBits=nOctave 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 N are 1, 2, or 4.
-ddeviceThe available output format is specified by the option device, and is one of:
psps2pscpsc2PostScript (level 1 and 2, mono and color). The FLTK graphics toolkit generates PostScript level 3.0.
epseps2epscepsc2Encapsulated PostScript (level 1 and 2, mono and color). The FLTK graphic toolkit generates PostScript level 3.0.
pslatexepslatexpdflatexpslatexstandaloneepslatexstandalonepdflatexstandaloneGenerate a LaTeX file filename.tex for the text
portions of a plot and a file filename.(ps|eps|pdf) for the
remaining graphics. The graphics file suffix .ps|eps|pdf is determined
by the specified device type. The LaTeX file produced by the
‘standalone’ option can be processed directly by LaTeX. The file
generated without the ‘standalone’ option is intended to be included
from another LaTeX document. In either case, the LaTeX file
contains an \includegraphics 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
exactly 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 ($ … $), and other
characters that are recognized by LaTeX may also need editing (.e.g.,
braces). The ‘pdflatex’ device, and any of the ‘standalone’
formats, are not available with the Gnuplot toolkit.
epscairopdfcairoepscairolatexpdfcairolatexepscairolatexstandalonepdfcairolatexstandaloneGenerate Cairo based output when using the Gnuplot graphics toolkit. The ‘epscairo’ and ‘pdfcairo’ devices are synonymous with the ‘epsc’ device. The LaTeX variants generate a LaTeX file, filename.tex, for the text portions of a plot, and an image file, filename.(eps|pdf), for the graph portion of the plot. The ‘standalone’ variants behave as described for ‘epslatexstandalone’ above.
illaifmAdobe Illustrator (Obsolete for Gnuplot versions > 4.2)
canvasJavascript-based drawing on HTML5 canvas viewable in a web browser (only available for the Gnuplot graphics toolkit).
cdrcorelCorelDraw
dxfAutoCAD
emfmetaMicrosoft Enhanced Metafile
figXFig. For the Gnuplot graphics toolkit, the additional options -textspecial or -textnormal can be used to control whether the special flag should be set for the text in the figure. (default is -textnormal)
gifGIF image (only available for the Gnuplot graphics toolkit)
hpglHP plotter language
jpgjpegJPEG image
latexLaTeX picture environment (only available for the Gnuplot graphics toolkit).
mfMetafont
pngPortable network graphics
pbmPBMplus
pdfPortable document format
svgScalable vector graphics
tikztikzstandaloneGenerate a LaTeX file using PGF/TikZ. For the FLTK toolkit the result is PGF. The ‘tikzstandalone’ device produces a LaTeX document which includes the TikZ file (‘tikzstandalone’ is only available for the Gnuplot graphics toolkit).
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.
-dghostscript_deviceAdditional devices are supported by Ghostscript. Some examples are;
pdfwriteProduces pdf output from eps
ljet2pHP LaserJet IIP
pcx24b24-bit color PCX file format
ppmPortable Pixel Map file format
For a complete list, type system ("gs -h") to see what formats
and devices are available.
When Ghostscript output is sent to a printer the size is determined by
the figure’s "papersize" property. When the output is sent to a
file the size is determined by the plot box defined by the figure’s
"paperposition" property.
-appendAppend PostScript or PDF output to a pre-existing file of the same type.
-rNUMResolution 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 "-r0".
-loose-tightForce a tight or loose bounding box for eps files. The default is loose.
-previewAdd a preview to eps files. Supported formats are:
-interchangeProvide an interchange preview.
-metafileProvide a metafile preview.
-pictProvide pict preview.
-tiffProvide a tiff preview.
-Sxsize,ysizePlot 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 "paperposition" property. When using the command form of
the print function you must quote the xsize,ysize option. For
example, by writing "-S640,480".
-Ffontname-Ffontname:size-F:sizeUse fontname and/or fontsize for all text. fontname is ignored for some devices: dxf, fig, hpgl, etc.
The filename and options can be given in any order.
Example: Print to a file using the pdf device.
figure (1); clf (); surf (peaks); print figure1.pdf
Example: Print to a file using jpg device.
clf (); surf (peaks); print -djpg figure2.jpg
Example: Print to printer named PS_printer using ps format.
clf (); surf (peaks); print -dpswrite -PPS_printer
See also: saveas, hgsave, orient, figure.
Package: octave