Hi Peter (and anyone else willing to help me out), Many thanks for your help. Having used your code plus a few other modifications, I only get the points plotted but without the two lines. I just cannot figure out what the problem is.
My code is as follows: library(lattice) datos2 <- subset(datos, samplesize != 10 & parm != "Theta0") unq <- sort(unique(datos2$samplesize)) datos2$fsamplesize <- factor(datos2$samplesize, labels = paste("Sample size =", unq)) datos2$parm <- factor(datos2$parm, levels = c("Intercept", "time", "trt", "time*trt")) tp1.sim <- xyplot(MSE ~ ntimes | fsamplesize + parm, group = group, data = datos2, type = "b", lty = 1:2, pch = 1:2, scales = list(x = list(at = c(2, 4, 8, 16)), alternating = 1), as.table = TRUE, key = list(text = list(c("GNA", "PNA")), points = list(pch = 1:2)) ) plot(tp1.sim) I have attached my real dataset (called datos) as well. Kind appreciations to your efforts. George On Wed, Oct 7, 2009 at 9:20 AM, Peter Ehlers <ehl...@ucalgary.ca> wrote: > see below > > George Kalema wrote: > >> Dear R users, >> I am trying to have an xyplot of a data set which has the following >> variables: >> case (n=10,20,30) >> parameter (parm=a,b) >> group (grp=g1,g2) >> y (y values) >> x (x=2,4,8) >> >> My plot should be parameter by case such that I have 2 rows (each row= >> each >> parameter) and 3 columns (each column=each case). My R-code is as follows >> but I am not able to get what I want to: >> >> tp1.sim <- xyplot(y~ x | case + parm , group=group, data = data, lty = 1:4 >> , >> pch = 1:4) >> print(tp1.sim) >> >> How can I have two lines (for g1 and g2) in each plot (each box)? >> > include the type="b" argument > > How do I label the x-axis with only values 2, 4, 8? >> > include the scales= argument or make x a factor > > How do I label each column with the corresponding case number? >> > make 'case' a factor > > The following should do what you want: > > xyplot(y ~ x | factor(case) + parm, group=group, data=data, > type='b', lty=1:2, pch=1:2, > scales=list(x=list(at=c(2,4,8))) > ) > > I don't understand why you want 4 line types/point chars. > > -Peter Ehlers > > >> My hypothetical data set is as follows: >> >> parm x case y group >> a 2 10 0.03 g1 >> b 2 10 0.02 g1 >> a 4 10 0.03 g1 >> b 4 10 0.02 g1 >> a 8 10 0.03 g1 >> b 8 10 0.02 g1 >> a 2 20 0.03 g1 >> b 2 20 0.02 g1 >> a 4 20 0.03 g1 >> b 4 20 0.02 g1 >> a 8 20 0.03 g1 >> b 8 20 0.02 g1 >> a 2 30 0.03 g1 >> b 2 30 0.02 g1 >> a 4 30 0.03 g1 >> b 4 30 0.02 g1 >> a 8 30 0.03 g1 >> b 8 30 0.02 g1 >> a 2 10 0.13 g2 >> b 2 10 0.12 g2 >> a 4 10 0.13 g2 >> b 4 10 0.12 g2 >> a 8 10 0.13 g2 >> b 8 10 0.12 g2 >> a 2 20 0.13 g2 >> b 2 20 0.12 g2 >> a 4 20 0.13 g2 >> b 4 20 0.12 g2 >> a 8 20 0.13 g2 >> b 8 20 0.12 g2 >> a 2 30 0.13 g2 >> b 2 30 0.12 g2 >> a 4 30 0.13 g2 >> b 4 30 0.12 g2 >> a 8 30 0.13 g2 >> b 8 30 0.12 g2 >> >> Many thanks in advance for your response. >> >> George >> >> [[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. >> >> >> -- ........................................ George Williams KALEMA, Schapenstraat 37/282, 3000 Leuven, Belgium. Cell: +32 495 33 13 02 ........................................
______________________________________________ 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.