PostScript
Last Updated: March 3, 2003
For some of the CS 779 assignments, you can use PostScript to generate
your plots. Only a simple subset of PostScript is required for these
questions.
The relevant PostScript commands are illustrated by the following
PostScript program:
%!
/Times-Roman findfont 10 scalefont setfont % select a font
newpath
0 0 moveto % This and the next two lines draw
100 100 lineto % a line segment from 0,0 to 100,100
stroke %
100 100 5 0 360 arc stroke % This line draws a circle centered at 100,100
110 100 moveto % This and the next line displays the
(P(0,0,0)) show % text ``P(0,0,0)'' at 110,100
showpage % This line prints the page
Note that a PostScript page is 612 by 792 pixels.
You can rescale your page to something that's more workable for your
problem by using the scale command. For example, if you want to have
the page extend from 0-10 in width, then issue the command
61.2 61.2 scale
before the newpath in the example above. One caution: PostScript printers
often can't draw near the borders. So you probably want to start drawing
a bit away from the edge of the page. This is easily done by using the
translate command. So for the above example, you're probably better off
saying
10 10 translate
61.2 61.2 scale
.016 setlinewidth
You will also need to rescale your font, so the font line should become
/Times-Roman findfont 10 61.5 div scalefont setfont
Further, you will want to draw a shorter lines, and you will need to
use a smaller font.