[R] continuous coloring of a polygon

Dieter Menne dieter.menne at menne-biomed.de
Fri Aug 15 17:36:48 CEST 2008


Roger Leenders <r.t.a.j.leenders <at> rug.nl> writes:

> 
> I have a polygon inside a circle as follows:
> 
.. Example code removed (but it's nice you included it)
> (the graph much resembles a speed dial inside a car).
> Now I want to fill the polygon with color, such that it starts on the 
> left with red and ends on the right with green, following the coloring 
> of the rainbow.

What comes closest is function gradient.rect in package plotrix. You could use
it as an starting example, and replace the rect() in it by polygon computed in
polar coordinates.

Dieter



More information about the R-help mailing list