[R] assigning 'heat.colors' according to ages in 'symbols()'

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 13 18:33:05 CEST 2006


On Thu, 13 Apr 2006, Patrick Kuss wrote:

> I have spatial data for plants that I would like to plot according to its radius
> using sysmbols(). Also I would like to color the circles according to an
> individual's age using heat.colors(17) [ages within the whole data set range
> from 0:16].
>
> I have not found an easy way to assign ages (=a) a specific heat.color.
>
> Any suggestions?
>
> Thanks, Patrick
>
> x <- c(1,3,4,6,7,3,2,8,3,6,5,5)
> y <- c(0,5,4,2,7,6,4,5,3,7,9,2)
> r <- c(0.1,0.4,0.3,0.2,0.5,0.3,0.2,0.4,0.3,0.2,0.1,0.2)
> a <- c(0,4,2,3,5,6,8,2,9,10,11,6)
>
> symbols(x,y,circles=r,bg=heat.colors(17),xlim=c(0,10),ylim=c(0,10),inches=F)

I think you are looking for bg=heat.colors(17)[1+a].

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