R: Plotting xts Objects

plot.xts {xts} | R Documentation

## 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,
             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

### 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.

### Value

Plots an xts object to the current device.

### Author(s)

Jeffrey A. Ryan

### Examples

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

[Package xts version 0.9-7 Index]