x <- 1:100 p <- rbind(cbind(x, 0.5*x^2), cbind(rev(x), rev(x^2))) matplot(x, cbind(x^2, 0.5*x^2), type = "l", col = 1, lty = 1) polygon(p, col = 2)
or some variant of that.
-roger
ivo welch wrote:
hi: is it possible to color areas between two functions? for example,
x<- 1:100; plot(x, x^2, type="l"); lines(x,0.5*x^2, type="l"); # better plotwithfill(x, x^2, 0.5*x^2, color=c("yellow", "red");
where the first color is used if f(x)=x^2 > g(x)=0.5*x^2, and the second for the reverse. Help appreciated.
Regards, / ivo
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
