[R] Math Expression and Variable Value in Title
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jan 29 10:23:19 CET 2004
Note that this will circumvent all the careful work in R to align the
plotmath text correctly. In your case that includes having space for the
subscript. It may not matter for main titles, but it certainly does for
ylab or axis annotation or ....
People might be producing PDF or Windows metafiles. I often produce PDF
figures for inclusion in my PDF lecture slides.
On Thu, 29 Jan 2004, Salvatore Barbaro wrote:
> An alternative but also higly recommendable way is the use of the
> psfrag-package in your LaTeX-file. It is furthermore very simple in use.
>
> Type
>
> plot(1:10, main="test")
>
> in your LaTeX-file you insert in your figure-environment the command
> \psfrag{test}{$n_i=20$}
> before you call the \includegraphics{}
>
> best regards
>
> yours
>
> s.
>
>
>
>
>
>
>
>
>
>
>
>
>
> Wolfgang Viechtbauer wrote:
> > Hello All,
> >
> > I am trying to put a math expression into a plot title and at the same
> > time, I want a value in the title to depend on a variable that I set
> > earlier.
> >
> > Simple Example:
> >
> > n <- 20
> > plot(0, 0)
> > title(expression(paste(n[i], " = ", n)))
> >
> > Obviously, I want "n_i = 20". How can I get that?
> >
> > Thanks in advance,
> >
>
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list