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:

 

week

High

Low

1

16

14.5

2

16

14.5

3

15.95

14.45

4

15.84

14.34

5

15.73

14.23

6

15.61

14.11

7

15.5

14

8

15.38

13.88

9

15.25

13.75

10

15.13

13.63

....

                
52

15

13.5

 

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.

 

l=11  #lower ylim

h=17  #upper ylim

par(new=F)

good <- complete.cases(week, high)     #get rid of the NA error and only
using non-missing pairs

par(new=T)

scatter.smooth(week[good], high[good],family = "gaussian",span = .2,
ylim=c(l,h), type='n', lwd=2, color="blue", ylab="", xlab="")  

good <- complete.cases(week, low)     

par(new=T)

scatter.smooth(week[good], low[good],family = "gaussian",span = .2,
ylim=c(l,h), type='n', lwd=2, color="red", ylab="Stage, feet",
xlab="Week of Year")  #loess, lower span makes more irregular

par(new=F)

 

Gregory A. Graves

Lead Scientist

Everglades REstoration COoordination and VERification (RECOVER) 

Watershed Division

South Florida Water Management District

Phones:  DESK: 561 / 682 - 2429 

             CELL:  561 / 719 - 8157

             

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to