[R] par(new=T) with xyplot

Frank E Harrell Jr fharrell at virginia.edu
Thu Jun 6 01:42:32 CEST 2002


On Wed, 05 Jun 2002 17:52:55 -0400
"Pikounis, V. Bill" <v_bill_pikounis at merck.com> wrote:

> I know I should not mix base plotting functions with grid/lattice functions,
> but I have used a "quick-and-dirty" trick of par(new=T) in the past for
> annotating a trellis-drawn graph in various versions of S-PLUS.  The
> sequence goes something like this:
> 
> > windows(width = 5, height = 5, pointsize = 10)  # open up the device
> 
> > xyplot(y ~ x)  
> > par(new=T)
> > xyplot(y2 ~ x)
> > par(new=F)  
> 
> Using R 1.5.0 in Windows, I tried this for the first time today, and the
> par(new=T) setting appears to be ignored by the second xyplot call; i.e.,
> the frame is cleaned and only the second printing of xyplot appears on the
> device.  (If instead of the second xyplot I use a base plot function like
> plot.default, the frame is not cleaned, which I want to happen). 
> 
> Is there anything analogous to par(new=T) that I could use to achieve this
> behavior of "not cleaning the frame" with lattice commands? Any workaround
> or advice is appreciated.  
> 
> Thanks in advance,
> Bill

Bill - I have had luck just doing par(usr=c(0,1,0,1)).  That's the way I add legends to Lattice graphs using the regular legend command.  [Actually I've used par(usr=c(0,1,0,1),xpd=NA) if it matters.]  But I haven't tried anything with two xyplot calls in a row.  -Frank


> ----------------------------------------
> Bill Pikounis, Ph.D.
> Biometrics Research Department
> Merck Research Laboratories
> PO Box 2000, MailDrop RY70-38  
> ## Please note that as of Wed 12 Jun 2002
> ## MailDrop will be RY84-16
> 126 E. Lincoln Avenue
> Rahway, New Jersey 07065-0900
> USA
> 
> v_bill_pikounis at merck.com
> 
> Phone: 732 594 3913
> Fax: 732 594 1565
> 
> 
> 
> ------------------------------------------------------------------------------
> Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.
> 
> ==============================================================================
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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 at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list