http://www.nabble.com/file/p15976467/table.pdf table.pdf I want to create 8 trellis (|experiment) scatterplots with regression lines for prey and pred in each plot with different colouring. So far i am creating trellis plots- but the separation in these groups is never possible. library(lattice) graphs<- read.table("table.txt", header=T) attach(graphs) names(graphs) str(graphs) xyplot(abund ~ bif | experiment, data=graphs, groups=stage, panel=function(x,y){panel.xyplot(x,y, pch=16) panel.abline(lm(y~x))}) Thanks a lot for your help!! Yvonne Fabian University of Fribourg -- View this message in context: http://www.nabble.com/Trellis-plots-with-two-regression-lines-tp15976467p15976467.html Sent from the R help mailing list archive at Nabble.com.
Yvonne, With ggplot2 you could tackle this problem with the code below. library(ggplot2) graphs<- read.table("table.txt", header=T) ggplot(data = graphs, aes(x = bif, y = abund)) + geom_point() + geom_smooth(method = "lm") + facet_grid(. ~ experiment) Have a look at the ggplot2 website for more info (http://had.co.nz/ggplot2/) HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx op inbo.be www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -----Oorspronkelijk bericht----- Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org] Namens yvo Verzonden: dinsdag 11 maart 2008 13:18 Aan: r-help op r-project.org Onderwerp: [R] Trellis plots with two regression lines http://www.nabble.com/file/p15976467/table.pdf table.pdf I want to create 8 trellis (|experiment) scatterplots with regression lines for prey and pred in each plot with different colouring. So far i am creating trellis plots- but the separation in these groups is never possible. library(lattice) graphs<- read.table("table.txt", header=T) attach(graphs) names(graphs) str(graphs) xyplot(abund ~ bif | experiment, data=graphs, groups=stage, panel=function(x,y){panel.xyplot(x,y, pch=16) panel.abline(lm(y~x))}) Thanks a lot for your help!! Yvonne Fabian University of Fribourg -- View this message in context: http://www.nabble.com/Trellis-plots-with-two-regression-lines-tp15976467 p15976467.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help op 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.
Try xyplot(abund ~ bif | experiment, data=graphs, groups=stage, type = c("p", "r")) See the help page for panel.xyplot(). Best regards Frede Aakmann T?gersen Scientist UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers All? 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1878 E-mail: FredeA.Togersen at agrsci.dk Web: http://www.agrsci.org This email may contain information that is confidential. Any use or publication of this email without written permission from Faculty of Agricultural Sciences is not allowed. If you are not the intended recipient, please notify Faculty of Agricultural Sciences immediately and delete this email.> -----Oprindelig meddelelse----- > Fra: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] P? vegne af yvo > Sendt: 11. marts 2008 13:18 > Til: r-help at r-project.org > Emne: [R] Trellis plots with two regression lines > > > http://www.nabble.com/file/p15976467/table.pdf table.pdf > > I want to create 8 trellis (|experiment) scatterplots with > regression lines for prey and pred in each plot with > different colouring. So far i am creating trellis plots- but > the separation in these groups is never possible. > > library(lattice) > graphs<- read.table("table.txt", header=T) > attach(graphs) > names(graphs) > str(graphs) > xyplot(abund ~ bif | experiment, data=graphs, groups=stage, > panel=function(x,y){panel.xyplot(x,y, pch=16) > panel.abline(lm(y~x))}) > > Thanks a lot for your help!! > Yvonne Fabian > University of Fribourg > > > -- > View this message in context: > http://www.nabble.com/Trellis-plots-with-two-regression-lines- > tp15976467p15976467.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Thanks a lot Thierry and Frede!!! Thats great- I made it much more complicated!!! -- View this message in context: http://www.nabble.com/Trellis-plots-with-two-regression-lines-tp15976467p16000637.html Sent from the R help mailing list archive at Nabble.com.