[R] Filling in a uniform dist plot

David Kaplan dkaplan at education.wisc.edu
Sat Aug 15 22:08:51 CEST 2009


Hi all,

Apologies in advance if this is really too simple, but I have given a 
good shot at this.  I'm generating a standard uniform distibution

y <- dunif(x)
plot(x,y,type="l")

This will draw a horizontal line at y = 1.  I want to fill the area from 
x=(0,1) with a color.  I've tried the polygon command to create a 
polygon of the same shape, but can't seem to set the parameters to fill 
the figure from x=(0,1).  I'm sure there is an easy way to do this, but 
any advice would be welcome.

Thanks in advance.

David




More information about the R-help mailing list