Add a shaded the region between two functions to an existing plot
envelopePlot.RdThis function shades the region vertically between two functions, specified as pairs of x and y vectors, and draws the functions in a darker shade. More formally, it shades all points (x,y) such that f1(x) < y < f2(x) or f2(x) < y < f1(x). When both functions have the same group of x values, the x values only need to be set once but y2 needs to be passed in by name. If the two functions intersect, the vertical space between the functions will be shaded on both sides, as implied in the definition above.
Arguments
- x1
The x coordinates for the first function (or possibly both functions).
- y1
The y coordinates for the first function.
- x2
The x coordinates for the second function.
- y2
The y coordinates for the second function.
- col
The color to make the filling between the functions.
- lineCol
The color to make the lines representing the functions.
- lwd
Line width of the envelope.
- ...
Additional arguments to the base R function
polygonthat is used to draw the shaded region – except for the upper and lower boundary lines.