Hi,
I plotted 12 graphs on a page and output to a png file. I wanted to
have an overall title for all 12 graphs. What command can I use to do
this? Below is the code that plotted the 12 graphs in one page.
# FM10 by Month/ Export the plot to Wash2005FM10.png
png(file="Wash2005FM10.png",bg="white")
par(mfrow = c(3,4))
# Plot 12 Month of OFM10, FFM10
for(i in 1:12) {
Temp <- subset (Wash2005, MM == i)
plot (Temp$FM10.1,
Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25))
}
text(10,10, "Overall Title") 'This will plot "Overall
Title" at
coordinate (10,10) on the last graph, and so it is not what I want.
dev.off()
Thank you.
Daniel Chan
Meteorologist
Georgia Forestry Commission
P O Box 819
Macon, GA
31202
Tel: 478-751-3508
Fax: 478-751-3465
[[alternative HTML version deleted]]
Have you thought of using split.screen instead?
Something like might work for you:
split.screen(c(1,1))
split.screen(c(3,4), 1)
for (i in 1:12) {
screen(i+1)
par(mar=c(2,2,4,2))
plot(1:20,rnorm(20),xlab="",ylab="")
}
screen(1)
title("Overall title")
On 23/10/06, Dan Chan <dchan at gfc.state.ga.us>
wrote:> Hi,
>
>
>
> I plotted 12 graphs on a page and output to a png file. I wanted to
> have an overall title for all 12 graphs. What command can I use to do
> this? Below is the code that plotted the 12 graphs in one page.
>
>
>
> # FM10 by Month/ Export the plot to Wash2005FM10.png
>
> png(file="Wash2005FM10.png",bg="white")
>
> par(mfrow = c(3,4))
>
> # Plot 12 Month of OFM10, FFM10
>
> for(i in 1:12) {
>
> Temp <- subset (Wash2005, MM == i)
>
> plot (Temp$FM10.1,
> Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25))
>
> }
>
> text(10,10, "Overall Title") 'This will plot "Overall
Title" at
> coordinate (10,10) on the last graph, and so it is not what I want.
>
> dev.off()
>
>
>
> Thank you.
>
>
>
> Daniel Chan
>
> Meteorologist
>
> Georgia Forestry Commission
>
> P O Box 819
>
> Macon, GA
>
> 31202
>
> Tel: 478-751-3508
>
> Fax: 478-751-3465
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
================================David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP
Hi Daniel:
Here is a sample code that I have used:
z1 <- rexp(100)
z2 <- rexp(100)
z3 <- rexp(100)
par(mfrow=c(2,2),oma = c(0, 0, 3, 0))
curve(dexp,from=0,to=5)
hist(z1,main="Size 5")
hist(z2,main="Size 15")
hist(z3,main="Size 30")
mtext("Densities", outer = TRUE, cex = 1.5)
And this will do the trick.
Hope this helps!
Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodgess at gator.uhd.edu
Hi,
I plotted 12 graphs on a page and output to a png file. I wanted to
have an overall title for all 12 graphs. What command can I use to do
this? Below is the code that plotted the 12 graphs in one page.
# FM10 by Month/ Export the plot to Wash2005FM10.png
png(file="Wash2005FM10.png",bg="white")
par(mfrow = c(3,4))
# Plot 12 Month of OFM10, FFM10
for(i in 1:12) {
Temp <- subset (Wash2005, MM == i)
plot (Temp$FM10.1,
Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25))
}
text(10,10, "Overall Title") 'This will plot "Overall
Title" at
coordinate (10,10) on the last graph, and so it is not what I want.
dev.off()
Thank you.
Daniel Chan
Meteorologist
Georgia Forestry Commission
P O Box 819
Macon, GA
31202
Tel: 478-751-3508
Fax: 478-751-3465
[[alternative HTML version deleted]]
______________________________________________
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.
"Dan Chan" <dchan at GFC.STATE.GA.US> wrote in message news:43679C69FEEE9C40AC8876C0FF38EF10014FEBD7 at mailsvr01.gfc.state.ga.us...> > I plotted 12 graphs on a page and output to a png file. I wanted to > have an overall title for all 12 graphs. What command can I use to do > this? Below is the code that plotted the 12 graphs in one page.Define an "outer margin area" at the top and put your overall title there. Find some illustrated examples of oma (outer margin area) and mar (margin area) here with mfrow/mfcol: http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm Perhaps this will get you started: # Outer margin area (South, West, North, East). # Default is all 0s, so ask for North oma of 2. # Trim some of the space form regular margins (mar) too. par(mfrow=c(3,4), mar=c(4,4.5,1,1), oma=c(0,0,2,0)) for (i in 1:12) { plot(0) } mtext("Overall Title", NORTH<-3, line=0.5, adj=0.5, col="red", outer=TRUE, cex=1.2) efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research