[R] Question with lattice xyplot
Deepayan Sarkar
deepayan at stat.wisc.edu
Tue Mar 22 18:01:02 CET 2005
On Tuesday 22 March 2005 10:26, Ghosh, Sandeep wrote:
> Hi All,
>
> I have a quick question and any help is greatly appreciated. For the
> following data when I try to produce the image using xyplot function
> in lattice package, the key has 4 rows instead of 2. Can anyone tell
> me what I'm doing wrong and what is the way to fix the problem. Here
> the code that I'm running
Your key is not formatted correctly. In particular, the first component
of key$points is (1) not named and (2) itself a list of length 4. Since
it's not named, it's not contributing anything to the key itself, but
the length of 4 confuses draw.key into thinking that the points
component should have 4 rows.
Deepayan
> print(xyplot(foldChange ~ timeInterval, data=studyData, type='b',
> groups = treatment, pch=1:treatmentCount,
> key = list(points = list(Rows(trellis.par.get("superpose.line"),
> c(1:treatmentCount)), col=Rows(trellis.par.get("superpose.line"),
> c(1:treatmentCount))$col, pch = 1:treatmentCount, type='b'), cex =
> trellis.par.get("superpose.symbol")$cex[1:treatmentCount], text =
> list(lab = as.character(unique(studyData$treatment))), columns = 1,
> border=TRUE,
> space="top"),
> ylab="Relative Change(1=12.50%tile)",
> xlab="Time Interval (hour)"));
>
> Thanks,
> Sandeep.
More information about the R-help
mailing list