addEventLines: Add vertical lines to an existing xts plot

Description Usage Arguments Author(s) Examples

View source: R/plot.R

Description

Add vertical lines and labels to an existing xts plot

Usage

1
addEventLines(events, main = "", on = 0, lty = 1, lwd = 1, col = 1, ...)

Arguments

events

xts object of events and their associated labels. It is assumed that the first column of events is the event description/label.

main

main title for a new panel if drawn.

on

panel number to draw on. A new panel will be drawn if on=NA. The default, on=0, will add to the active panel. The active panel is defined as the panel on which the most recent action was performed. Note that only the first element of on is checked for the default behavior to add to the last active panel.

lty

set the line type, same as in par.

lwd

set the line width, same as in par.

col

color palette to use, set by default to rational choices.

...

any other passthrough parameters to text to control how the event labels are drawn

Author(s)

Ross Bennett

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
library(xts)
data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
events <- xts(letters[1:3], 
              as.Date(c("2007-01-12", "2007-04-22", "2007-06-13")))
plot(sample.xts[,4])
addEventLines(events, srt=90, pos=2)

## End(Not run)

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

xts documentation built on Sept. 13, 2020, 5:09 p.m.