R-beta: Legends and Postscript devices

Jim Lemon (bitwrit@ozemail.com.au)
Thu, 14 May 1998 13:11:16 +0000


Date: Thu, 14 May 1998 13:11:16 +0000
From: Jim Lemon <bitwrit@ozemail.com.au>
To: r-help@stat.math.ethz.ch
Subject: R-beta: Legends and Postscript devices

Ernesto,

1) I generally preview the graphics on the x11() display, and then print
to a file using the 'postscript' output device.  Using the following
procedure has never failed for me.

>plot(x,y,...)
>legend(...)
>postscript("Rplots.ps",paper="a4",width=6,height=5,
+ family="Times")
>plot(x,y,...)
>legend(...)
>dev.off
>system("lpr Rplots.ps")

(In fact, I usually encapsulate the whole affair in a specially written
plotting routine which allows me to choose whether or not to produce
hard copy with a keystroke.)  You can, of course, call the output file
anything you please.  Trying to use '/dev/lp1' (or whatever your
Postscript device file is) is usually not a good idea.  When I have
messed up a legend on hard copy, it has usually been because of improper
x/y placement.

2) The problem brought up by F. Moro (9/5/98) may be relevant to your
second request.  If you just want an axis label, the following will
produce one.

> par(mar=c(5,5,5,5))
> plot(...)
> axis(...)
> mtext("y2",side=4,line=3)

Jim

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._