[R] shading between two smoothed curves

Jim Lemon jim at bitwrit.com.au
Fri Aug 14 12:55:48 CEST 2009


Graves, Gregory wrote:
> I have a set of 52 weekly values, one is the desired high lake stage for
> a week, and the other is the desired low lake stage for each week.  It
> looks like this:
> ...
> I can plot out two nice curves using the following code, but I can't
> figure out how to shade in the area lying between the two curves.  I
> also can't figure out how to adjust the line weight as lwd doesn't seem
> to affect scatter.smooth.  Thanks in advance.
>   

Hi Gregory,
You can use "polygon" by running across either the upper or lower 
values, then backwards across the other set. For an example of how to do 
this, look at the source code of the dispersion function in the plotrix 
package.

Jim




More information about the R-help mailing list