[R] Polygon Shading Based on Relative Line Position

2010-05-06 Thread emorway
Forum, I have two time series that I plot up using the data/code below. The x-axis shows weekly time step starting on 6/3/1999 (SP=10) and ending on 10/25/2007 (SP=448). I'm trying to shade between the two lines in a similar fashion as the graph found here:

Re: [R] Polygon Shading Based on Relative Line Position

2010-05-06 Thread emorway
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

Re: [R] Polygon Shading Based on Relative Line Position

2010-05-06 Thread Joris Meys
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