xts (version 0.9-7)

plot.xts: Plotting xts Objects

Description

Plotting methods for xts objects.

Usage

# S3 method for xts
plot(x, y = NULL,
         type = "l", 
         auto.grid = TRUE,
         major.ticks = "auto",
         minor.ticks = TRUE,
         major.format = 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

major.format

passed along to axTicksByTime. See also

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

# NOT RUN {
data(sample_matrix)
plot(sample_matrix)
plot(as.xts(sample_matrix))
plot(as.xts(sample_matrix), type='candles')
# }