ymdShade {tis} | R Documentation |
Shading Date Ranges
Description
ymdXy
returns a list of x and y coordinates that can be fed
to polygon
to draw NBER shadings on the current plot.
If the last row of the ymds
argument has a Start entry but an "NA"
End entry and openShade
is FALSE
, the returned list will
not have coordinates for the last row, but will instead include a
vLine element that gives the x coordinate of the last Start. If
openShade
is TRUE
(the default), the list includes x
and y coordinates for the last row of ymds
, using the second
element of the horizontal range determined by the xrange
parameter as its end time.
ymdShade
shades date ranges on the current tisPlot.
on the current plot. It calls ymdXy
to get x and y
coordinates for the areas to be shaded and then passes those
coordinates along with its own arguments to polygon
to
do the shading. It also draws a vertical line at the appropriate
location if the list returned by ymdXy
has a vLine element.
Usage
ymdShade(ymds, col = grey(0.8), border = FALSE, xpd = FALSE,
xrange = NULL, openShade = TRUE, ...)
ymdXy(ymds, xrange = NULL, openShade = TRUE)
Arguments
All but ymds
are passed along to polygon
:
ymds |
a matrix of yyyymmdd dates with two columns named 'Start'
and 'End' that specifies the date ranges to be shaded.
|
col |
color to shade recessionary periods |
border |
the default ( |
xpd |
should clipping take place? |
... |
other args passed to |
xrange |
horizontal range over which recession shading should be
drawn. The default value |
openShade |
governs how |
Value
As described above, ymdXy
returns a list. ymdShade
does not return anything useful.
See Also
Examples
require("datasets")
plot(presidents, type='n', ylab="Presidents approval rating")
ymdShade(nberDates())
lines(presidents)