Hello, Try this way (not sure if it's the best way, but it works):
boxplot(x[,i], main=substitute(expression(paste(a," ",italic(b)," ",c)),list(a=mainlabel1,b=predictor[i],c=mainlabel2)), ylab=paste(ylabel),cex.lab=cexalabel,cex.main=cexmlabel,cex.axis=1.5) Best, Miguel On Mon, Mar 8, 2010 at 2:27 PM, Bernd Panassiti <bernd.panass...@rivm.nl>wrote: > Dear R users, > > in the example below the name of the genus will be displayed in the main > titles using the variable predictor[i] and paste. > I would like to have the genus name in italic. However all my attempts > using expression and substitute failed. > Does anybody know a solution? > Thanks a lot in advance. bernd > > > Acrobeles <-c(65.1,0.0,0.0,0.0,0.0,0.0) > Acrobeloides <-c(0.0,9.8,76.7,51.1,93.9,43.9) > Alaimus <-c(0.0,4.9,0.0,0.0,0.0,6.3) > Aphelenchoides <-c(126.5,29.3,76.7,134.1,176.7,87.9) > > x<-data.frame(Acrobeles,Acrobeloides,Alaimus,Aphelenchoides) > > predictor <- colnames(x) > ylabel <-"Numerical abundance" > mainlabel1 <-"Boxplot for" > mainlabel2 <-"sp." > cexalabel <-1.8 # axis label > cexmlabel <-1.6 # main label > > par(oma=c(6,6,3,3),mar = c(6, 4, 4, 2) + 0.1,mfrow=c(2,2)) > > for (i in 1:ncol(x)){ > > boxplot(x[,i], > > main=paste(mainlabel,predictor[i],mainlabel2),ylab=paste(ylabel),cex.lab=cexalabel,cex.main=cexmlabel,cex.axis=1.5) > } > > > > --------------------------------------------------------------------------- > > Bernd Panassiti > > National Institute of Public Health & the Environment (RIVM) > Laboratory for Ecological Risk Assessment (LER) > P.O. Box 1 > 3720 BA Bilthoven > The Netherlands > e-mail: bernd.panass...@rivm.nl > tel. +31 30 274 3647 > > Radboud University Nijmegen > Department of Environmental Science > b.panass...@science.ru.nl > > > > Disclaimer RIVM > [[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 > and provide commented, minimal, self-contained, reproducible code. > [[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 and provide commented, minimal, self-contained, reproducible code.