Re: [R] filling the area

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Thu 25 Jan 2007 - 14:57:24 GMT

Yep.

Keep in mind that you need to define the complete boundaries of the region to be colored. So you need to add the coordinates of the lower left and lower right hand points, which are [min(x), min(y)] and [max(x), min(y)].

HTH, Marc

On Thu, 2007-01-25 at 11:14 -0300, Mauricio Cardeal wrote:
> Thank you all. One more question about the syntax below: min(y) twice, is it?
>
> polygon(c(min(x), x, max(x)), c(min(y), y, min(y)), col = "blue")
>
> polygon( c(min(x), x, max(x)), c( min(y), y, min(y)), density=100 )
>
> Best whises,
> Mauricio
>
>
>
> Marc Schwartz escreveu:
> > On Thu, 2007-01-25 at 10:18 -0300, Mauricio Cardeal wrote:
> >
> >> Please, how to fill the area under the curve?
> >>
> >> x <- c(1:10)
> >> y <- c(rnorm(10))
> >> plot(x,y)
> >> lines(x,y)
> >>
> >> Thanks,
> >> Mauricio Cardeal
> >>
> >
> > See ?polygon
> >
> > x <- 1:10
> > y <- rnorm(10)
> >
> > plot(x,y, type = "o")
> >
> > polygon(c(min(x), x, max(x)), c(min(y), y, min(y)), col = "blue")
> >
> >
> > HTH,
> >
> > Marc Schwartz
> >



R-help@stat.math.ethz.ch 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. Received on Fri Jan 26 02:26:39 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 16:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.