Displaying 1 result from an estimated 1 matches for "areacol".
2009 May 24
1
filling area under a function line
...can I have some colour with that
please ;-)"
So I found the easiest way to do that was to attach a polygon call onto
the end of the curve function definition;
else plot(x, y, type = type, ylab = ylab, xlim = xlim, log = lg,
+ polygon(
+ c(from, x, to),
+ c(min(y),y,min(y)),
+ col=areacol, lty=0
+ )
}
areacurve(sin(2*pi*6*x+pi/2),areacol="red")
and stick that in my r init file.
Now the question is, am I missing something elementary here?
Cheers,
T
areacurve<-function (expr, from = NULL, to = NULL, n = 101, add =
FALSE,
type = "l", ylab = NULL,...