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])))Thanks in advance, Giovanni -- Giovanni Petris <GPetris at uark.edu> Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/
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])))
Try bquote: plot(0, 0, main = bquote(n == .(k) * "," ~ N[eff] == .(n.eff[k]))) On Thu, Oct 9, 2008 at 12:22 PM, Giovanni Petris <GPetris at uark.edu> wrote:> > 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]))) > > Thanks in advance, > Giovanni > > -- > > Giovanni Petris <GPetris at uark.edu> > Associate Professor > Department of Mathematical Sciences > University of Arkansas - Fayetteville, AR 72701 > Ph: (479) 575-6324, 575-8630 (fax) > http://definetti.uark.edu/~gpetris/ > > ______________________________________________ > R-help at 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. >