Hello,
I have been struggling to do a plot in ggplot(2) that's of lattice equivalent.
The following code shows the lattice plot.
dd<-rbind(data.frame(rbind(c("V1","A",0.3),c("V2","A",0.5),c("V3","A",0.2))),data.frame(rbind(c("V1","B",0.3),c("V2","B",0.4),c("V3","B",0.8))),data.frame(rbind(c("V1","C",0.9),c("V2","C",0.2),c("V3","C",0.4))))
require(lattice)
xyplot(X3 ~ X1, data=dd, type="l", group=X2, panel = function(x,y,...)
{ panel.xyplot(x,y,...)
panel.loess(x,y,lty=2,lwd=1,...) })
I would like to obtain the same result in ggplot(2), but the following does not
give the equivalent above. I wonder whether anybody can help?
require(ggplot2)
p <- ggplot(dd, aes(x=X1,y=X3,group=X2))p <-p + geom_smooth(method =
"loess",se=FALSE, lty=2,lwd=1)p + geom_line(aes(col=X2))
Many Thanks,
Cham
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.