[R] shading between two smoothed curves
jim at bitwrit.com.au
Fri Aug 14 14:47:07 CEST 2009
Graves, Gregory wrote:
> I will attempt to distill my problem down to a simpler one, the solution of which will hopefully lead me to the nirvana of complete understanding, i.e., inserting a polygon beneath an irregular line terminated by the x axis.
> I 'know' that polygon will work -provided- I knew the xy coordinates of the line(s) beneath which I desire to create the polygon. Unfortunately, I don't know how to get at that info.
> Below is an example of a irregular line for which the xy coordinates are not known (i.e., at least not by me). I assume my problem boils down to finding out how to extract the xy from that line.
> plot(dist ~ speed)
> scatter.smooth(speed, dist,family = "gaussian",span = .2)
That's right, just call the underlying function (loess.smooth) and use
"str" on the result. There should be x and y components that can be
passed to "lines".
More information about the R-help