AIL PROTECTED] On Behalf Of Van Dongen Stefan
> Sent: Monday, September 17, 2007 7:37 AM
> To: [EMAIL PROTECTED]
> Subject: [R] graphs with gradients of colors
>
> Hi All,
>
> I would like to fill the area under a curve with a gradient
> of colors. Are
Van Dongen Stefan wrote:
> Hi All,
>
> I would like to fill the area under a curve with a gradient of colors. Are
> there any packages or trick I could use
>
>
Hi Stefan,
Chris has answered the question of how to define the polygons, so I'll
have a shot at the gradient. The plotrix package
You could use a loop and fill small polygons with colors.
x<-seq(-3, 3, .01)
y<-eval(expression(x^3-3*x))
plot(x,y, type="n", las=1)
n<-length(x)
# vertical bars
for(i in 1:n)
{
polygon(c(x[i], x[i], x[i+1], x[i+1]), c(min(y), y[i], y[i+1], min(y)),
border=0, col = rainbow(n)[i])
}
## or sp
Maybe this information (from the R's father) can be of some help.
http://www.stat.auckland.ac.nz/~ihaka/Graphics/index.html
Van Dongen Stefan wrote:
>
> Hi All,
>
> I would like to fill the area under a curve with a gradient of colors. Are
> there any packages or trick I could use
>
> Thank
Hi All,
I would like to fill the area under a curve with a gradient of colors. Are
there any packages or trick I could use
Thanks
Stefan
Stefan Van Dongen
Antwerp
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing li
5 matches
Mail list logo