Hii, I will combine some plots. Like this example here http://www.statmethods.net/advgraphs/layout.html I tired to do it for 2 plots but without success. Here is my code: test<-read.table(file="D:/file.txt") space<-read.table(file="D:/space.txt") space$gruppe <- 502*rep(1:6, each=7) x<- c(test$V1) y<- c(test$V2) par(mfrow=c(1,1)) png(filename = "D:/example.png", width = 640, height = 480, pointsize = 12, bg = "white", res = NA) boxplot(V2 ~ gruppe , data = space , col = "lightgray",boxwex=0.2) plot(panel.first=grid(ny=NULL,nx=NULL),x,y, xlab = "Zeit(sec)", ylab ="Datenrate(MBit(sec))",ylim=c(0,40), col ="purple", type ="l", main ="combined plots",lwd=2) dev.off() What is the mistake in my code ? -- View this message in context: http://www.nabble.com/Problems-with-combining-plots-tp22646692p22646692.html Sent from the R help mailing list archive at Nabble.com.
par(mfrow=c(1,1)) will give you just one panel. Try par(mfrow=c(2,1)) or par(mfrow=c(1,2)). -----Original Message----- From: r-help-bounces at r-project.org on behalf of johnhj Sent: Sun 3/22/2009 10:50 AM To: r-help at r-project.org Subject: [R] Problems with combining plots Hii, I will combine some plots. Like this example here http://www.statmethods.net/advgraphs/layout.html I tired to do it for 2 plots but without success. Here is my code: test<-read.table(file="D:/file.txt") space<-read.table(file="D:/space.txt") space$gruppe <- 502*rep(1:6, each=7) x<- c(test$V1) y<- c(test$V2) par(mfrow=c(1,1)) png(filename = "D:/example.png", width = 640, height = 480, pointsize = 12, bg = "white", res = NA) boxplot(V2 ~ gruppe , data = space , col = "lightgray",boxwex=0.2) plot(panel.first=grid(ny=NULL,nx=NULL),x,y, xlab = "Zeit(sec)", ylab ="Datenrate(MBit(sec))",ylim=c(0,40), col ="purple", type ="l", main ="combined plots",lwd=2) dev.off() What is the mistake in my code ? -- View this message in context: http://www.nabble.com/Problems-with-combining-plots-tp22646692p22646692.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.
I have still the same problem... As you said I tried with par(mfrow=c(2,1)) and par(mfrow=c(1,2)) but without success. Could R compiler be the problem ? Wills, Kellie wrote:> > par(mfrow=c(1,1)) will give you just one panel. Try par(mfrow=c(2,1)) or > par(mfrow=c(1,2)). > > > -----Original Message----- > From: r-help-bounces at r-project.org on behalf of johnhj > Sent: Sun 3/22/2009 10:50 AM > To: r-help at r-project.org > Subject: [R] Problems with combining plots > > > Hii, > > I will combine some plots. Like this example here > http://www.statmethods.net/advgraphs/layout.html I tired to do it for 2 > plots but without success. > > Here is my code: > > test<-read.table(file="D:/file.txt") > space<-read.table(file="D:/space.txt") > > space$gruppe <- 502*rep(1:6, each=7) > x<- c(test$V1) > y<- c(test$V2) > > par(mfrow=c(1,1)) > > png(filename = "D:/example.png", width = 640, height = 480, pointsize > 12, > bg = "white", res = NA) > > boxplot(V2 ~ gruppe , data = space , col = "lightgray",boxwex=0.2) > plot(panel.first=grid(ny=NULL,nx=NULL),x,y, xlab = "Zeit(sec)", ylab > ="Datenrate(MBit(sec))",ylim=c(0,40), col ="purple", type ="l", main > ="combined plots",lwd=2) > > dev.off() > > > What is the mistake in my code ? > > > -- > View this message in context: > http://www.nabble.com/Problems-with-combining-plots-tp22646692p22646692.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. > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/Problems-with-combining-plots-tp22646692p22658673.html Sent from the R help mailing list archive at Nabble.com.
On 23 Mar 2009, at 11:52, johnhj wrote:> > I have still the same problem... As you said I tried with > par(mfrow=c(2,1)) > and par(mfrow=c(1,2)) but without success. Could R compiler be the > problem ? >Why not? But may I suggest you try first the following example I sent you yesterday,> png() > > par(mfrow=c(2,1) ) > > plot(1:10) > > plot(1:10) > > dev.off()Does this not produce two plots on a single page? baptiste PS: please do read the posting guide> > 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.> > Wills, Kellie wrote: >> >> par(mfrow=c(1,1)) will give you just one panel. Try >> par(mfrow=c(2,1)) or >> par(mfrow=c(1,2)). >> >> >> -----Original Message----- >> From: r-help-bounces at r-project.org on behalf of johnhj >> Sent: Sun 3/22/2009 10:50 AM >> To: r-help at r-project.org >> Subject: [R] Problems with combining plots >> >> >> Hii, >> >> I will combine some plots. Like this example here >> http://www.statmethods.net/advgraphs/layout.html I tired to do it >> for 2 >> plots but without success. >> >> Here is my code: >> >> test<-read.table(file="D:/file.txt") >> space<-read.table(file="D:/space.txt") >> >> space$gruppe <- 502*rep(1:6, each=7) >> x<- c(test$V1) >> y<- c(test$V2) >> >> par(mfrow=c(1,1)) >> >> png(filename = "D:/example.png", width = 640, height = 480, >> pointsize >> 12, >> bg = "white", res = NA) >> >> boxplot(V2 ~ gruppe , data = space , col = "lightgray",boxwex=0.2) >> plot(panel.first=grid(ny=NULL,nx=NULL),x,y, xlab = "Zeit(sec)", ylab >> ="Datenrate(MBit(sec))",ylim=c(0,40), col ="purple", type ="l", main >> ="combined plots",lwd=2) >> >> dev.off() >> >> >> What is the mistake in my code ? >> >> >> -- >> View this message in context: >> http://www.nabble.com/Problems-with-combining-plots-tp22646692p22646692.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. >> >> ______________________________________________ >> 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. >> >> > > -- > View this message in context: http://www.nabble.com/Problems-with-combining-plots-tp22646692p22658673.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._____________________________ Baptiste Augui? School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag
Hii baptiste, I tried you example, but I get still one plot and not as you said two plots ... I use R for Windows, could this have something to do with this problem ? baptiste auguie-2 wrote:> > > On 23 Mar 2009, at 11:52, johnhj wrote: > >> >> I have still the same problem... As you said I tried with >> par(mfrow=c(2,1)) >> and par(mfrow=c(1,2)) but without success. Could R compiler be the >> problem ? >> > > Why not? But may I suggest you try first the following example I sent > you yesterday, > > >> png() >> >> par(mfrow=c(2,1) ) >> >> plot(1:10) >> >> plot(1:10) >> >> dev.off() > > > Does this not produce two plots on a single page? > > > baptiste > > > PS: please do read the posting guide >> >> 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. > > > >> >> Wills, Kellie wrote: >>> >>> par(mfrow=c(1,1)) will give you just one panel. Try >>> par(mfrow=c(2,1)) or >>> par(mfrow=c(1,2)). >>> >>> >>> -----Original Message----- >>> From: r-help-bounces at r-project.org on behalf of johnhj >>> Sent: Sun 3/22/2009 10:50 AM >>> To: r-help at r-project.org >>> Subject: [R] Problems with combining plots >>> >>> >>> Hii, >>> >>> I will combine some plots. Like this example here >>> http://www.statmethods.net/advgraphs/layout.html I tired to do it >>> for 2 >>> plots but without success. >>> >>> Here is my code: >>> >>> test<-read.table(file="D:/file.txt") >>> space<-read.table(file="D:/space.txt") >>> >>> space$gruppe <- 502*rep(1:6, each=7) >>> x<- c(test$V1) >>> y<- c(test$V2) >>> >>> par(mfrow=c(1,1)) >>> >>> png(filename = "D:/example.png", width = 640, height = 480, >>> pointsize >>> 12, >>> bg = "white", res = NA) >>> >>> boxplot(V2 ~ gruppe , data = space , col = "lightgray",boxwex=0.2) >>> plot(panel.first=grid(ny=NULL,nx=NULL),x,y, xlab = "Zeit(sec)", ylab >>> ="Datenrate(MBit(sec))",ylim=c(0,40), col ="purple", type ="l", main >>> ="combined plots",lwd=2) >>> >>> dev.off() >>> >>> >>> What is the mistake in my code ? >>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Problems-with-combining-plots-tp22646692p22646692.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. >>> >>> ______________________________________________ >>> 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. >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Problems-with-combining-plots-tp22646692p22658673.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. > > _____________________________ > > Baptiste Augui? > > School of Physics > University of Exeter > Stocker Road, > Exeter, Devon, > EX4 4QL, UK > > Phone: +44 1392 264187 > > http://newton.ex.ac.uk/research/emag > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/Problems-with-combining-plots-tp22646692p22662039.html Sent from the R help mailing list archive at Nabble.com.