[R] Passing colnames to graphics title

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Wed Feb 16 18:51:06 CET 2005


Either set the 'main' or 'xlab' in the hist(). See help("par") for more
information on graphical arguments or help("hist").

mat <- matrix( rnorm(1000), nc=5 )
colnames(mat) <- LETTERS[1:ncol(mat)]

for( i in 1:ncol(mat) ){
 hist( mat[ ,i], 
       main=paste( "Histogram of data from column ", 
       colnames(mat)[i] ),  xlab="" )
}




On Wed, 2005-02-16 at 13:56 +0000, Laura Quinn wrote:
> Hi,
> 
> Just a quick query - if I'm creating a function to produce a number of
> histograms per page of output (one per column from a matrix), how can I
> pass the column name of the matrix into the title (or indeed to form part
> of the x-axis label)?
> 
> TIA,
> Laura
> 
> Laura Quinn
> Institute of Atmospheric Science
> School of Earth and Environment
> University of Leeds
> Leeds
> LS2 9JT
> 
> tel: +44 113 343 1596
> fax: +44 113 343 6716
> mail: laura at env.leeds.ac.uk
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list