[R] Write text in the

Matthew Neilson matt at gneilson.plus.com
Fri Apr 27 16:54:20 CEST 2007


Hey Felix,

So basically what you want is a figure containing a block of four plots, with a main title for the figure? If that's the case then something like this should work:

# BEGIN CODE #

par(oma=c(0,0,1,0), mfrow=c(2,2))
for(i in 1:4){
plot(NA,xlim=range(0,10),ylim=range(-5,5))
title(paste("Plot ",i,sep=""))
}

par(mfrow=c(1,1), oma=c(0,0,1,0))
mtext("Main Title", 3, outer = TRUE, cex = par("cex.main"))

# END CODE #

You can play about with the margins, but I think that's the general idea. Is this what you're after?


-Matt



On Fri Apr 27 15:34 , Felix Wave <felix-wave at vr-web.de> sent:

>Hello,
>I started a graphic device:
>>par(oma = c(2,0,0,0), mfrow=c(2,2) )
>
>in the cols and rows are three "image"s.
>Now I want to write a text in the "device region", it's the
>main title of the graphic device. But when I use "mtext()" I can
>only write in the "figure region" of my four plots.
>
>Has anybody an idea?
>
>Thanks a lot.
>
>Felix
>
>
>
>My R Code:
>----------
>par(oma = c(2,0,0,0), mfrow=c(2,2) )
>
>mtext("Main title", side = 3, line = 0)
>
>image(zDIV)
>image(zMEDIAN )              
>image(zMEAN) 
>image(zSD)  
>dev.off() 
>
>
>
>graphic:   
>
>-------------------------------------------
>|	MAIN TITLE   device region	   
>-------------------------------------------
>|   figure region    |   figure region    |
>|  --------------    |    ------------    |
>|  |		|    |	  |	     |	  |
>|  |		|    |    |	     |    |
>|  |		|    |	  |	     |	  |
>|  |		|    |    |	     |    |
>|  --------------         ------------    |
>|					  |	      
>-------------------------------------------
>|   figure region    |   figure region    |
>|  --------------    |    ------------    |
>|  |		|    |	  |	     |	  |
>|  |		|    |    |	     |    |
>|  |		|    |	  |	     |	  |
>|  |		|    |    |	     |    |
>|  --------------         ------------    |
>|					  |
>
>______________________________________________
>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.



More information about the R-help mailing list