[R] Plotting expressions with indicies

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 12 09:12:55 CEST 2003


On Mon, 12 May 2003, Noel Yvonnick wrote:

> I would like to plot a series of math symbols on a graph with ordered indicies 
> : expression(delta[1]) expression(delta[2]) etc.
> 
> Is there a mean to write this in a for loop ?
> 
> for(i in 1:6) text(i,i,expression(delta[i]))
> 
> does not work ('i' is not evaluated).

Try

> plot(1:6, type="n")
> for(i in 1:6) text(i,i,substitute(delta[i], list(i=i)))



-- 
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