Looking at the source code of the function diagwl() (which is used to
produce that one), the "shading" appears to be drawn using the function
segments(). Basically, the difference d between both lines is calculated,
and then the shading is done by using different lty and col when d is
positive or negative

# part of the code of diagwl
  pi <- approx(xl[1:n2],yl[1:n2],n=66)$y
  ti <- approx(x,c(tm[12],tm[1:12],tm[1]),n=66)$y
  d <- pi - ti
  xi <- (1:66)/5-0.7
  xw <- subset(xi,d>0) #periodo húmedo
  y1 <- subset(pi,d>0)
  y2 <- subset(ti,d>0)
  if(length(xw)>0) segments(xw,y1,xw,y2,col=pcol,lty=1,lwd=1)
  xw <- subset(xi,d<0) #periodo seco
  y1 <- subset(pi,d<0)
  y2 <- subset(ti,d<0)
  if(length(xw)>0) segments(xw,y1,xw,y2,col=tcol,lty=3,lwd=2)
# end part of the code

Maybe not exactly what you're looking for, but a nice work-around if you ask
me. It won't allow you to use full-colored surfaces though, but I can see a
similar reasoning working for that as well.

On Thu, May 6, 2010 at 4:32 PM, emorway <emorway@engr.colostate.edu> wrote:

>
> The last sentence should read:
>
> Due to the 20 or so times the lines cross each other I wasn't sure how to
> modify the last example in ?polygon
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Polygon-Shading-Based-on-Relative-Line-Position-tp2132718p2132720.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
Joris.Meys@Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]

