Hi, I would like to have six dot plots on one page. I make the plots in a 'for loop' because it is six times the same graph but for different subjects (species). I tried it with "par(mfrow=c(3,2), oma=c(3,3,2,0), mar=c(2,2,2,2))"; but this does not work for dot plots apparently. Then I tried with print(). But then I had to give the dot plots names. This also does not work. Any one who has some more ideas? What do I do wrong? species.vector<-c("Lp","Pp","Pl","Ra","Lc","Ml") for(i in 1:6){ XXXX<- inputdot[inputdot$sp_==species.vector[i],] str(XXXX) XX7<-subset(XXXX,chamber==7) XX8<-subset(XXXX,chamber==8) XX9<-subset(XXXX,chamber==9) XX10<-subset(XXXX,chamber==10) species.vector[i] <- dotplot(XX7$BG_dry~XX7$stress,ylim=c(0,20),ylab="biomass",scales=list(ti ck.number=10), panel = function (x, y) { panel.abline(v=c(1:8),lty=2,col="gray") panel.xyplot(x, y, pch = 1, col = "blue", cex = .75) panel.xyplot(XX8$stress,XX8$BG_dry, pch = 16, col = "red", cex = .6) panel.xyplot(XX9$stress,XX9$BG_dry, pch = 2, col = "blue", cex = .6) panel.xyplot(XX10$stress,XX10$BG_dry, pch = 17, col = "red", cex = .6) }, key = list(text = list(c("ch7", "ch8","ch9","ch10"), cex = .75), points = list(pch = c(1, 16,2,17), col = c("blue","red","blue","red"), cex = .75), space = "bottom", border = T),main=species.vector[i]) ) } print(Lp, split=c(1,1,2,3), more=TRUE) print(Pp, split=c(2,1,2,3), more=TRUE) print(Pl, split=c(1,2,2,3), more=TRUE) print(Ra, split=c(2,2,2,3), more=TRUE) print(Lc, split=c(1,3,2,3), more=TRUE) print(Ml, split=c(2,3,2,3)) Thanks a lot! Joke Joke Van den Berge, PhDs University of Antwerp, Campus Drie Eiken Department of Biology Research Group of Plant and Vegetation Ecology Universiteitsplein 1 B-2610 Wilrijk, Belgium email: Joke.VandenBerge@ua.ac.be <mailto:Joke.VandenBerge@ua.ac.be> tel: +32 3 820 22 72 fax: +32 3 820 22 71 [[alternative HTML version deleted]]
Hi r-help-bounces at r-project.org napsal dne 26.08.2008 17:06:27:> Hi, > > > > I would like to have six dot plots on one page. I make the plots in a > 'for loop' because it is six times the same graph but for different > subjects (species). > > I tried it with "par(mfrow=c(3,2), oma=c(3,3,2,0), mar=c(2,2,2,2))"; but > this does not work for dot plots apparently.You mix standard and grid graphics which I would not recommend without detailed knowledge of both. From what you write I presume that you want 6 panels on one page. Maybe you could try to put discriminating variable to dotplot directly? Something like dotplot(XX7$BG_dry~XX7$stress|inputdot$sp) Regards Petr> > Then I tried with print(). But then I had to give the dot plots names. > This also does not work. > > Any one who has some more ideas? What do I do wrong? > > > > species.vector<-c("Lp","Pp","Pl","Ra","Lc","Ml") > > > > for(i in 1:6){ > > XXXX<- inputdot[inputdot$sp_==species.vector[i],] > > str(XXXX) > > XX7<-subset(XXXX,chamber==7) > > XX8<-subset(XXXX,chamber==8) > > XX9<-subset(XXXX,chamber==9) > > XX10<-subset(XXXX,chamber==10) > > > > species.vector[i] <- > > dotplot(XX7$BG_dry~XX7$stress,ylim=c(0,20),ylab="biomass",scales=list(ti > ck.number=10), > > panel = function (x, y) { > > panel.abline(v=c(1:8),lty=2,col="gray") > > panel.xyplot(x, y, pch = 1, col = "blue", cex = .75) > > panel.xyplot(XX8$stress,XX8$BG_dry, pch = 16, col = "red", cex = .6) > > panel.xyplot(XX9$stress,XX9$BG_dry, pch = 2, col = "blue", cex = .6) > > panel.xyplot(XX10$stress,XX10$BG_dry, pch = 17, col = "red", cex = .6) > > }, > > key = list(text = list(c("ch7", "ch8","ch9","ch10"), cex = .75), > > points = list(pch = c(1, 16,2,17), col = c("blue","red","blue","red"), > cex = .75), > > space = "bottom", border = T),main=species.vector[i]) ) > > } > > > > print(Lp, split=c(1,1,2,3), more=TRUE) > > print(Pp, split=c(2,1,2,3), more=TRUE) > > print(Pl, split=c(1,2,2,3), more=TRUE) > > print(Ra, split=c(2,2,2,3), more=TRUE) > > print(Lc, split=c(1,3,2,3), more=TRUE) > > print(Ml, split=c(2,3,2,3)) > > > > Thanks a lot! > > Joke > > > > Joke Van den Berge, PhDs > > University of Antwerp, Campus Drie Eiken > > Department of Biology > > Research Group of Plant and Vegetation Ecology > > Universiteitsplein 1 > > B-2610 Wilrijk, Belgium > > > > email: Joke.VandenBerge at ua.ac.be <mailto:Joke.VandenBerge at ua.ac.be> > > tel: +32 3 820 22 72 fax: +32 3 820 22 71 > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guideR-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.