[R] continuous coloring of a polygon

Johannes Hüsing johannes at huesing.name
Fri Aug 15 20:41:17 CEST 2008


Am 15.08.2008 um 14:00 schrieb Roger Leenders:

> I can draw the polygon as above, but I don't know how to do the 
> coloring. It is easy to give the polygon only one color (e.g. through 
> polygon(c(x1,x2),c(y1,y2), col="red")), but I need a way in which to 
> color the polygon such that the color moves through the color spectrum 
> from red (left) to green (right).
> Can anyone help me to achieve this?
>
I don't know of another way than to segment the polygon and give the 
segments distinctive colours. The function rainbow(n, start=0, end=1/3) 
might help specifying the colours, where n is chosen sufficiently high.



More information about the R-help mailing list