> nams<-c("P2O5 [%]", "D50 [mum]") These are strings; plotmath is invoked on expressions. Also, in an expression, [] has special meaning (it's treated as a subscripted index), so a space followed by '[' causes an error and even if that didn't happen, [] would not give units in square brackets.
However, there is (perhaps surprisingly) nothing wrong with horrible constructions like enams<-c(expression(P[2]*O[5]*" [%]"), expression("D50 ["*mu*"]")) par(mfrow=c(2,1)) for (i in 1:2) plot(1, 1, xlab=nams[i]) # As far as plotmath is concerned, '*' is represented graphically as implicit multiplication, # and since it's just graphical, plotmath doesn’t care that some of the things being multiplied # are actually strings. The plotmath page also has a lot of examples of programmatic substitution in plotmath expressions; they just have to be followed very carefully. And ?bquote is also useful for substitution in plotmath... S Ellison ******************************************************************* This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the sender immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com and delete this message and any copies from your computer and network. LGC Limited. Registered in England 2991879. Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.