chart_xts2y: Plot two _xts_ time series with two y-axes in an x11 window.

Description Usage Arguments Details Value Examples

View source: R/rutils.R

Description

Plot two xts time series with two y-axes in an x11 window.

Usage

1
chart_xts2y(x_ts, col_or = "red", x_11 = TRUE, ...)

Arguments

x_ts

An xts time series with two columns.

col_or

A string specifying the color of the second line and axis (default is "red").

x_11

A Boolean argument: if TRUE then open x11 window for plotting, else plot in standard window (default is TRUE).

...

Additional arguments to function plot.zoo().

Details

The function chart_xts2y() creates a plot of two xts time series with two y-axes. By default chart_xts2y() opens and plots in an x11 window. The function chart_xts2y() uses the standard plotting functions from base R, and the function plot.zoo() from package zoo.

Value

The x_ts column names returned invisibly, and a plot in an x11 window produced as a side effect.

Examples

1
2
3
# Plot two time series
rutils::chart_xts2y(cbind(quantmod::Cl(rutils::etf_env$VTI),
                          quantmod::Cl(rutils::etf_env$IEF))["2015"])

algoquant/rutils documentation built on Feb. 26, 2021, 1:30 a.m.