[R] plotting question: filling area between two lines

Achim Zeileis zeileis at ci.tuwien.ac.at
Tue Feb 25 18:05:04 CET 2003


On Tuesday 25 February 2003 17:51, Christof Bigler wrote:

> Is there any way to fill the area within a plotted line and a
> horizontal line, e.g. in the following example:
>
> x <- rnorm(100)
> plot(x,type="l")
> abline(h=0)

You could do
   polygon(c(1, 1:100, 100), c(0, x, 0), col = "grey")
in the above example.
Z

> Thanks for any help.
>
> Christof
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list