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

(Ted Harding) ted.harding at nessie.mcc.ac.uk
Wed Mar 7 10:55:29 CET 2007


On 07-Mar-07 ONKELINX, Thierry wrote:
> Creating more than one graphic windows is, as far as I know, not
> possible in R.

It is if you are running R on Linux (in which the X Windowing
System -- or X -- is the standard graphical system). As it
says in "?X11":

  "This can only be done on machines that run X."

Then each call to X11() opens a new graphics window, so you
can have as many as you like.

And, using the "display" parameter in X11(), if you have monitors
for more than one machine on your desk you can "throw" each window
to a monitor of your choice, giving you multiple graphics windows
on multiple screens, all from the same run of R.

But, as to whether/to what extent X or equivalent is available for
MS Windows, that is another question on which I have no expertise.

Ted.

> 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 at 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 at stat.math.ethz.ch [mailto:r-help-
>> bounces at stat.math.ethz.ch] Namens Faramarzi Monireh
>> Verzonden: woensdag 7 maart 2007 9:39
>> Aan: r-help at 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 at 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.
> 
> ______________________________________________
> R-help at 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.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 07-Mar-07                                       Time: 09:55:12
------------------------------ XFMail ------------------------------



More information about the R-help mailing list