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

View source: R/rutils.R

chart_xts2yR Documentation

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

Description

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

Usage

chart_xts2y(xtsv, color = "red", x11 = TRUE, ...)

Arguments

xtsv

An xts time series with two columns.

color

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

x11

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 xtsv column names returned invisibly, and a plot in an x11 window produced as a side effect.

Examples

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

algoquant/rutils documentation built on April 18, 2024, 12:05 a.m.