Skip to content
Prev 58829 / 398502 Next

substitute/paste question for using Greek in plot titles

Peter Dunn wrote:

            
Peter,

Because in the first couple of lines of plot.formula we see this:

dots <- m$...
dots <- lapply(dots, eval, data, parent.frame())

which for your case is equivalent to:

expr <- substitute(paste("A vaue for ",phi," = ",phival), 
list(phival=phi.1))
eval(expr)

which returns an error saying "phi" cannot be found which is the correct 
behaviour of eval. I'll let others comment on whether or not this is a 
bug in plot.formula but you can always get around it by calling title:

plot(0 ~ 0)
title(main = expr)

which is exactly what your second example is doing in plot.default.

HTH,

--sundar