Skip to content

vectorized plotmath expressions via substitute()

5 messages · Murat Tasan, William Dunlap, Gabor Grothendieck +1 more

#
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
#
On Wed, Nov 14, 2012 at 12:05 PM, Murat Tasan <mmuurr at gmail.com> wrote:
See

library(sfsmisc)
?eaxis

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
3 days later
#
On 15.11.2012 10:52, Gabor Grothendieck wrote:
Or to answer the original question, without an extra package we could 
simply:

plot(1, xaxt="n")
axis(1, at=axTicks(1), as.expression(lapply(axTicks(1), function(x) 
substitute(10^foo, list(foo=x)))))

Uwe Ligges