Learn R Programming

xts (version 0.0-16)

plot.xts: Plotting xts Objects

Description

Plotting methods for xts objects.

Usage

## S3 method for class 'xts':
plot(x, y = NULL,
         type = "l", 
         auto.grid = TRUE,
         major.ticks = "auto",
         minor.ticks = TRUE,
         bar.col = "grey",
         candle.col = "white",
         ann = TRUE, axes = TRUE, ...)

Arguments

x
an xts object
y
an xts object or NULL
type
type of plot to produce
auto.grid
should grid lines be drawn
major.ticks
should major tickmarks be drawn and labeled
minor.ticks
should minor tickmarks be drawn
bar.col
the color of the bars when type is bars or candles
candle.col
the color of the candles when type is candles
ann
passed par graphical parameter
axes
passed par graphical parameter
...
additional graphical arguments

Value

  • Plots an xts object to the current device.

Details

Mainly used to draw time-series plots with sensible x-axis labels, it can also plot basic OHLC series using type='candles' or type='bars'.

Better financial plots can be found in the quantmod package, though these are generally incompatible with standard R graphics tools.

Examples

Run this code
data(sample_matrix)
plot(sample_matrix)
plot(as.xts(sample_matrix))
plot(as.xts(sample_matrix), type='candles')

Run the code above in your browser using DataLab