[R] How to open more windows to make more graphs at once!

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Mar 7 10:18:03 CET 2007


Creating more than one graphic windows is, as far as I know, not
possible in R. But it's no problem to run a script which create multiply
jpeg's. See ?jpeg on how to create jpeg's.

Cheers,

Thierry

------------------------------------------------------------------------
----

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach 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 stat.math.ethz.ch [mailto:r-help-
> bounces op stat.math.ethz.ch] Namens Faramarzi Monireh
> Verzonden: woensdag 7 maart 2007 9:39
> Aan: r-help op stat.math.ethz.ch
> Onderwerp: [R] How to open more windows to make more graphs at once!
> 
> 
> Dear R users,
> I have a data frame (test) including five columns of upper (numeric),
> lower (numeric), observed (numeric), best_sim (numeric) and stname
(factor
> with 80 levels, each level with different length). Now I would like to
> write a short program to draw one graph as follow for each level of
stname
> but I would like also to draw each time 12 graphs for the 12 levels of
> stname in the same graphic windows and save it as "jpeg' file . This
means
> at the end I will have 7 (80 levels/12=7) graphic windows and 7 jpeg
files
> each one with 12 graphs (the last one with 8 graphs) for the 12 levels
of
> stname. I already wrote the following script to do it each time for 12
> levels of stname but I have to change script each time for the another
12
> levels [line 3 in the script for example: for( i in
> levels(test$stname)[12:24))] and I do not know how can I save the
obtained
> graphs (seven graphic windows) as jpeg files (e.g. plot1.jpeg,
plot2.jpeg
> and so on). As I have 45 dataset like this it would be gr!
>  eat if somebody can help me to complete this script to do all
together
> for a dataset using a script.
> Thank you very much in advance for your cooperation,
> Monireh
> 
> 
> 
> windows(9,9)
> par(mfrow = c(3,4))
> for( i in levels(test$stname)[1:12])
> {
> data<- test[test$stname==i,]
> xx <- c(1:length(data$upper), length(data$upper):1)
> yy <- c(data$upper, rev(data$lower))
> zz<- data$observed
> tt<- data$Best_Sim
> par(lab =c(10,15,2))
> plot.jpeg<- plot(xx,yy, type="n", xlim=c(min(xx), max(xx)),
> ylim=c(min(zz,yy,tt), max(yy,zz,tt)*1.4),
>  main= i, xlab="Month (1990-2002)",  ylab="Discharge(m3/s)",
font.axis=6)
> polygon(xx, yy, col="green",  border = "NA")
> lines(zz, col="blue", lwd=1.5)
> lines(tt,col="red", lwd=1.5)
> legend(length(zz)-60, max(yy,zz,tt)*1.45, c("Upper Limit", "Lower
Limit",
> " Observed","Best etimation")
> , lwd=c(10, 1,1.7,1.7), bty="n", col= c("green", "white",
"blue","red"))
>  }
> 
> ______________________________________________
> R-help op stat.math.ethz.ch 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.



More information about the R-help mailing list