Hi Gregory,
 
> 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. 
 
Use polygon.
 
> ?polygon

>>> "Graves, Gregory" <ggra...@sfwmd.gov> 14/08/2009 4:17 am >>>
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.


******************************************************************************

This email message, including any attached files, is confidential and
intended solely for the use of the individual or entity to whom it is
addressed. 

The NSW Department of Commerce prohibits the right to publish, 
copy, distribute or disclose any information contained in this email, 
or its attachments, by any party other than the intended recipient. 
If you have received this email in error please notify the sender and
delete it from your system.

No employee or agent is authorised to conclude any binding 
agreement on behalf of the NSW Department of Commerce by email. The
views or opinions presented in this email are solely those of the author
and do not necessarily represent those of the Department, 
except where the sender expressly, and with authority, states them to be
the views of NSW Department of Commerce.  

The NSW Department of Commerce accepts no liability for any loss or
damage arising from the use of this email and recommends that the
recipient check this email and any attached files for the presence of
viruses. 

******************************************************************************

        [[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