Hi: Try this:
xyplot(y ~ x1 | x2 * x3, groups = x4, data = example, type= c("l", "p"), pch=c(16, 4), col=c("blue", "red"), col.line = c('blue', 'transparent'), xlim = c(1.04, 1.26), ylim = c(0, 1.1), xlab = "X2", ylab = "Y", key = list(space = "top", text = list("A"), points = list(pch=16, col="blue", cex=0.8), text = list("B"), points = list(pch=4, col="red", cex=0.8))) I think you had your A and B labels reversed in the legend, but check to be sure. HTH, Dennis On Sat, Mar 12, 2011 at 10:47 PM, Jie Liu <jerryli...@gmail.com> wrote: > Hi guys, > > I got a problem when I was trying to use lattice to do some plot. Below is > one working example which can generate one curve for A and one curve for B > in each subplot. However, I would like to just show the points for B, not > connecting the dots. As for A, I still want a curve (dots are connected). > Is > there any people having any suggestions. Data are attached. Thanks a lot, > > --Jerry > > library(lattice) > example <- read.csv("example.txt",header=T) > xyplot(y~x1|as.factor(x2)*as.factor(x3), groups = as.factor(x4), > data=example, type="b", pch=c(16,4), col=c("blue","red"), > xlim=c(1.04,1.26), > ylim = c(0,1.1), xlab = "X2", ylab = "Y",key = list(space = "top", text = > list("B"), points = list(pch=16, col="blue", cex=0.8), text = list("A"), > points = list(pch=4, col="red", cex=0.8)) ) > > ______________________________________________ > R-help@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. > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.