[R] Automated figure production

Petr Pikal petr.pikal at precheza.cz
Mon Feb 26 09:52:51 CET 2007



On 26 Feb 2007 at 9:14, Sergey Goriatchev wrote:

Date sent:      	Mon, 26 Feb 2007 09:14:17 +0100
From:           	"Sergey Goriatchev" <sergeyg at gmail.com>
To:             	r-help at stat.math.ethz.ch
Subject:        	[R] Automated figure production

> Hello, everybody
> 
> Two questions:
> 
> 1) I am new to maillists, and particularly to r-help maillist. Where
> specifically do I go online to see my question and answers to it??? If
> I use the searchable archives, or archives by Robert King, I see my
> question but not the answers, though I know that at least one persion
> posted the answer to r-help. Why do not I see the answers?

You is close. Try click on latest R-help in Searchable R-list archive

> 
> 2)
> 
> I need to produce 104 figures. In each graphic window I want to plot 8
> figures. How do I automate the process so that it opens 13 separate
> graphic windows in R Gui and plots the figures? (I then paste them in
> Word, one by one). Also, how do I save all 104 figures to one PDF
> file?

see ?pdf, ?png 

> 
> Here is the code to produce the figures, and at this point I change
> the j-index in the for-loop by hand, produce 8 figures, copy them to
> Word, then change j to 9:16 etc...
> 
> #HOW TO PRODUCE ALL 104 GRAPHS AT ONCE
> 

e.g.
cycle
png(name.based.on.cycle.pointer, 800,800)
> old.par<-par(no.readonly=TRUE)
> par(mfrow=c(4,2))
> 
> for(j in 1:8) {
> plot(Cleaned[zz[,j],4], type="b", main=long.names[j], xlab="Month",
> ylab="MFR", col="blue") abline(h=0, col="red") } par(old.par)
> 

dev.off()
endcycle

or similar without cycle using pdf device see onefile=T option

HTH
Petr


> 
> Thanks for your help!
> Sergey
> 
> -- 
> Laziness is nothing more than the habit of resting before you get
> tired. - Jules Renard (writer)
> 
> Experience is one thing you can't get for nothing.
> - Oscar Wilde (writer)
> 
> When you are finished changing, you're finished.
> - Benjamin Franklin (President)
> 
> ______________________________________________
> 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.

Petr Pikal
petr.pikal at precheza.cz



More information about the R-help mailing list