Re: [R] plotting question: filling area between two lines

About this list Date view Thread view Subject view Author view Attachment view

From: Achim Zeileis (zeileis@ci.tuwien.ac.at)
Date: Wed 26 Feb 2003 - 04:01:27 EST


Message-id: <200302251701.h1PH1RV3001102@thorin.ci.tuwien.ac.at>

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@stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:23 EST