[R] filling the area

2007-01-25 Thread Mauricio Cardeal
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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] filling the area

2007-01-25 Thread Benilton Carvalho
take a look at: ?polygon b On Jan 25, 2007, at 8:18 AM, 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 __ R-help@stat.math.ethz.ch mailing

Re: [R] filling the area

2007-01-25 Thread Mauricio Cardeal
Ok. I´ve tried before and all I got was a polygon indeed with the extremes points connected. Please where is the error ? polygon(x,y,col=gray, border = red) Benilton Carvalho escreveu: take a look at: ?polygon b On Jan 25, 2007, at 8:18 AM, Mauricio Cardeal wrote: Please, how to fill

Re: [R] filling the area

2007-01-25 Thread Marc Schwartz
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,

Re: [R] filling the area

2007-01-25 Thread Mario Cortina Borja
PROTECTED] Tel - 020 7905 2113 FAX - 020 7905 2381 -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Mauricio Cardeal Sent: 25 January 2007 13:19 To: r-help@stat.math.ethz.ch Subject: [R] filling the area Please, how to fill the area under

Re: [R] filling the area

2007-01-25 Thread Mauricio Cardeal
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,

Re: [R] filling the area

2007-01-25 Thread Marc Schwartz
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:

Re: [R] filling the area

2007-01-25 Thread Henrique Dallazuanna
Hi Maurício! Look at this link also: http://www.feferraz.net/br/shaded.html On 25/01/07, Mauricio Cardeal [EMAIL PROTECTED] 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

[R] filling the area between two curves in a plot

2004-02-19 Thread Rajarshi Guha
Hi, does anybody know how I can color the area enclosed between two curves on a plot? Thanks, --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE

RE: [R] filling the area between two curves in a plot

2004-02-19 Thread Liaw, Andy
Assuming the coordinates for the two curves are x1, y1, x2 and y2, and that the pairs are sorted by x1 and x2, respectively. Then just do something like: polygon(c(x1, rev(x2)), c(y1, rev(y2), ...) HTH, Andy From: Rajarshi Guha Hi, does anybody know how I can color the area enclosed

Re: [R] filling the area between two curves in a plot

2004-02-19 Thread Thomas Petzoldt
Rajarshi Guha wrote: Hi, does anybody know how I can color the area enclosed between two curves on a plot? This is possible with the polygon function. Try something like: # create some data x - sort(runif(10, min=0, max=10)) y - runif(10, min=2, max=5) #Polygon-Plot plot(x,y, type=n,

Re: [R] filling the area between two curves in a plot

2004-02-19 Thread Thomas Lumley
On Thu, 19 Feb 2004, Rajarshi Guha wrote: Hi, does anybody know how I can color the area enclosed between two curves on a plot? There is an example of this in demo(graphics). -thomas __ [EMAIL PROTECTED] mailing list