[R] Two math expressions in plot
Mark Lyman
mark.lyman at atk.com
Thu Oct 9 20:52:52 CEST 2008
Giovanni Petris <GPetris <at> uark.edu> writes:
>
>
> Hello!
>
> I am trying to put two math expressions in the title of a plot. As
> you can see below, I can place correctly one expression at a time, but
> not both. Ideally I would like to have them separated by a comma. Any
> suggestions?
>
> > k <- 1
> > n.eff <- c(20, 30)
> > ### this works
> > plot(0,0, main = substitute(n == k, list(k = k)))
> > ### this works
> > plot(0,0, main = substitute(N[eff] == neff, list(neff = n.eff[k])))
> > ### this doesn't work
> > plot(0,0, main = substitute(n == k * N[eff] == neff, list(k = k, neff =
n.eff[k])))
>
This should do it for you:
plot(0,0, main = substitute(paste(n == k*", ", N[eff] == neff), list(k = k,
neff = n.eff[k])))
More information about the R-help
mailing list