Recipe for PostScript...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Recipe for PostScript...

Jonathan M Hill
Hi there;

     Maybe this note will help another newbie, like myself. In my
digging about I produced a ``RECIPE FOR POSTSCRIPT,'' I'll summarize
with a short example.  Start with some data.

> data = [1 1; 2 2; 3 4];
> gplot data

     At this point you have a plot on the display, spice it
up by adding a title and label the axes.

> gset title 'My Title'
> gset xlabel 'X Axis'
> gset ylabel 'Y Axis'
> replot

     Next, produce the PostScript file

> gset term post
> gset out "test.ps"
> replot

     At this point the display should have disappeared, but a file
  named test.ps should have appeared in your working directory.
  The replot command is handy!  To return `to normal', just gset
  the term and replot.

> gset term x11
> replot

                                     I hope this helps;
                                              Jonathan Hill
                                              [hidden email]




Reply | Threaded
Open this post in threaded view
|

Re: Recipe for PostScript...

Huaiyu Zhu
Interesting recipe ... Here's the thing packaged:

Sometime ago I wrapped up these steps in the following .m file,
but did not realize it would be of general interest.  If you find
it handy and pass it on, consider it GPL'ed.  It differs from
the matlab print command in that there is no choice of output
formats - but who want anything other than postscript nowadays?  :-)


% print.m
% print to a postscirpt file

function print (file)

file = ["\"", file, "\""];

gset term postscript
gset ("output", file)
replot
gset term x11
replot

endfunction


--
Huaiyu Zhu                      Tel: 1 505 984 8800 ext 305      
Santa Fe Institute              Fax: 1 505 982 0565
1399 Hyde Park Road             mailto:[hidden email]          
Santa Fe, NM 87501              http://www.santafe.edu/~zhuh/ 
USA                             ftp://ftp.santafe.edu/pub/zhuh/