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) } Thank you for your time and help! [[alternative HTML version deleted]]
use the 'main' parameter: for (i in 1:6){ plot(x,y,main=paste("Plot:", i)) } On Thu, Jan 7, 2010 at 11:24 AM, Trafim Vanishek <rdapamoga@gmail.com>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) > } > > > Thank you for your time and help! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
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