Outputting to a Postscript File
There are two main uses for graphs in Postscript format. The first is
to have a copy you can print later, without using GnuPlot. You need
regular Postscript files for this. The second is to include the graph
in another document. For this option you need to use Encapsulated
Postscript Files. This is a special form of Postscript that can be
included in documents. (EPS files don't have the extra lines that are
used when a PS file is printed directly to a printer). To generate a
postscript file, do the following:
- set output "filename.ps" where filename.ps is the
name of the output file.
- set terminal postscript
- replot
To print this file from the command line (not in GnuPlot), type
- lp filename.ps To use the default printer, or
- lp -dlj3sib filename.ps To use the printer lj3sib.
If you print to this file again, it will append the graph to the end
of the file as a second page. For instance,
- set output "file2.ps"
- set terminal postscript
- splot sin(x*y)
- plot x**2
would create a 2-page postscript file called "file2.ps". The first
page would be the plot of z=sin(xy) and the second page would
be the plot of y=x2. Usually, you will only want the
one graph in each PS file.
When you want to return to printing to the screen, type the following
two lines:
- set output
- set terminal x11
Options for set terminal postscript
There are several options for this command:
- set terminal postscript color - This will create a
postscript file with color in it. The default is "monochrome", which
only produces black and white images.
- set terminal postscript solid - This will use solid lines
when printing, instead of the default "dashed". This usually creates
better looking graphs.
Printing to EPS files
To print to an EPS file, you do the same as for PS files, but use the
following set terminal command.
- set output "filename.eps"
- set terminal postscript eps
Make sure you only print one image to each EPS file.
Table of Contents - Previous - Printing to Printer - Next - Outputting to a Graphics File
College of Natural Sciences /
University of Northern Iowa /
manager@cns.uni.edu
Copyright © 1996 College of Natural Sciences. All Rights Reserved.
Last Modified: 10/29/96