I recommend using bquote(), with its .() substitution operator, instead of substitute any time you use plotmath. To make a vector of plotmath expressions use the following sort of as.expression(lapply(... bquote ...)) idiom:
plot(1:10, axes=FALSE) at <- axTicks(1) lab <- as.expression(lapply(at, function(a)bquote(10^.(a)))) axis(1, at=at, lab=lab) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Murat Tasan > Sent: Wednesday, November 14, 2012 9:06 AM > To: r-help@r-project.org > Subject: [R] vectorized plotmath expressions via substitute() > > hi all - i've seen versions of this question before, but none seem to get > directly at my solving my (probably very simple) issue: > > i simply want to annotate the tick marks on an axis with (superscripted) > 10^x notation, and tried this: > > axis(1, at = axTicks(1), as.expression(substitute(10^foo, list(foo = > axTicks(1)))) > > thinking the as.expression/substitute would create the appropriate > expression vector from the expansion of the foo vector. > i'm continually stuck in the error process, however, with axis() where R > complains that i've only provided a single label. > i must be missing a function that explicitly "unfolds"(?) the result of the > substitute() call, without actually evaluating the contents of that call? > > sorry in advance if this is clear in the docs somewhere, though i just > can't seem to locate it :-/ > > cheers and thanks for any pointers! > > -murat > > [[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. ______________________________________________ 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.