[R] Graph titles from massive

David Winsemius dwinsemius at comcast.net
Thu Jan 7 17:56:56 CET 2010


On Jan 7, 2010, at 11:24 AM, Trafim Vanishek wrote:

> Dear all,
>
> I would like to ask you if there is a possibility in R to give the  
> names to
> graphs which are not const.
> For example,
>
> How to name each plot, or to add notes like a=x[i], b=y[i] in this  
> cycle
>
> x<-c(1,2,3,4,5,6)
> y<-c(7,8,9,10,11,12)
>
> par(mfrow=c(2,3))
>
> for (i in 1:6){
> plot(x,y)
> }

This might be what you want:

 > x<-c(1,2,3,4,5,6)
 > y<-c(7,8,9,10,11,12)
 >
 > par(mfrow=c(2,3))
 >
 > for (i in 1:6){
+ plot(x,y, main=paste("this is plot # ", i, sep=""))
+ }
 >

I initially thought you wanted the object names to be different for  
which this answer would not be responsive and no answer could be  
provided since that is not how base graphics work. For that you would  
need grid, lattice, or ggplot methods.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list