Camarda, Carlo Giovanni
2012-Apr-05 10:41 UTC
[R] xyplot with different pch and col in each panel and additional line
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120405/be19cc65/attachment.ksh>
Jim Lemon
2012-Apr-05 10:50 UTC
[R] xyplot with different pch and col in each panel and additional line
On 04/05/2012 08:41 PM, Camarda, Carlo Giovanni wrote:> Dear R-users, > > I'd like to use an xyplot(lattice) in which in each panel I have points with different point-character and color, and additional lines with the same color. Please find below a toy example in which I did not manage to change such parameters, and the associated basic plot() in which I show what I aim to within lattice. > > Thanks for any help you could provide, > Giancarlo Camarda > > library(lattice) > y<- seq(0,1, length=15) > yy<- y + rnorm(15,sd=0.05) > dataset<- data.frame(time = rep(1:5,times=3), > y = y, > yy = yy, > type = rep(LETTERS[1:3], each=5)) > > xyplot(yy+y ~ time | type, dataset, > layout=c(3,1), > type=c("p", "l"), > col=c(1,2), > panel = function(...) { > panel.superpose.2(...) > }) > > par(mfrow=c(1,3)) > plot(1:5, yy[1:5], pch=1, col=3, ylim=c(0,1)) > lines(1:5, y[1:5], col=2) > plot(1:5, yy[1:5+5], pch=2, col=4, ylim=c(0,1)) > lines(1:5, y[1:5+5], col=2) > plot(1:5, yy[1:5+10], pch=3, col=5, ylim=c(0,1)) > lines(1:5, y[1:5+10], col=2) > >Hi Carlo, If all you want is the "look" of the panel plot, you might find that the "panes" function (plotrix) will give you that. See the examples. Jim