[R] How to insert gridlines in lattice density plot

Bert Gunter gunter.berton at gene.com
Thu Apr 22 22:52:03 CEST 2010


" Must one compose a panel function?"

Depending on what you want exactly, no. Add the argument

type="g"

to your call.
(e.g.
   densityplot(~fallrates,  groups = prepost,type="g",...
)

See ?panel.xyplot  and recall that lattice passes down arguments that it
does not know what to do with to the panel function.

Bert Gunter
Genentech Nonclinical Biostatistics
 
 
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Giles
Sent: Thursday, April 22, 2010 1:31 PM
To: r-help at r-project.org
Subject: [R] How to insert gridlines in lattice density plot

Greetings.

How can I  insert gridlines
in the following density plot call?
Must one compose a panel function?

'data.frame':   46 obs. of  2 variables:
  $ fallrates: num  5.2 7.1 7.1 9.8 3.7 7.5 5 6.2 1.5 2.9 ...
  $ prepost  : Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...

library(lattice)

   densityplot(~fallrates,  groups = prepost,
      kernal="triangular", lwd=2,
      plot.points = TRUE, ref = TRUE, auto.key = list(columns = 2),
      main="Estimated fall rate density, pre and post intevention")


Thank you for your consideration and comments.
Giles Crane

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list