Re: [R] greek letters, text, and values in labels

From: Marc Schwartz (via MN) <>
Date: Wed 26 Jul 2006 - 06:37:58 EST

On Tue, 2006-07-25 at 13:12 -0700, Adrian Dragulescu wrote:
> Hello,
> I want to have a title that will look something like:
> "Results for \theta=2.1", given that I have a variable theta=2.1, and
> \theta should show on the screen like the greek letter.
> I've tried a lot of things:
> theta <- 2.1
> plot(1:10, main=expression(paste("Results for", theta, "=", eval(theta))))
> or using bquote
> plot(1:10, main=paste("Results for ", bquote(theta == .(theta))))
> or using substitute, etc. I could not make it work. This should be easy.
> I would appreciate your help.
> Thanks,
> Adrian


Try this:

  theta <- 2.1
  plot(1:10, main = bquote(paste("Results For: ", theta == .(theta))))

You need to surround the full expression with bquote() so that the paste()d text is within it. bquote() then returns an expression that is passed to plotmath.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed Jul 26 06:43:20 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 26 Jul 2006 - 08:24:00 EST.

Mailing list information is available at Please read the posting guide before posting to the list.