[R] how to plot shaded area under a curve?

jim holtman jholtman at gmail.com
Thu Sep 13 12:59:00 CEST 2007


try this:

> x=seq(0,5,len=100)
> y=-(x-5)^2
>
> plot(x,y)
> polygon(c(x,x[length(x)]), c(y, y[1]), col='red')


On 9/13/07, gallon li <gallon.li at gmail.com> wrote:
> say, I am plotting
>
> x=seq(0,5,len=100)
> y=-(x-5)^2
>
> plot(x,y)
>
> how can I put some color or verticle lines below the plotted curve?
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list