rtsplot2Y {rtsplot} | R Documentation |
Plot time series with second Y axis
Description
Detailed discussion for validity of dual Y axis at [Dual axes time series plots may be ok sometimes after all](http://freerangestats.info/blog/2016/08/18/dualaxes)
Usage
rtsplot2Y(y, las = 1, type = "l", col.axis = "red", ylim = NULL, log = "", ...)
Arguments
y |
|
las |
rotation of Y axis labels, defaults to 1, for more info see |
type |
plot type, defaults to 'l', for more info see |
col.axis |
axis color, defaults to 'red' |
ylim |
range on Y values, defaults to NULL |
log |
log scale x, y, xy axes, defaults to ” |
... |
additional parameters to the |
Value
nothing
Examples
# generate time series data
y = rtsplot.fake.stock.data(1000)
symbol = 'SPY'
y1 = rtsplot.fake.stock.data(1000, 100)
symbol = 'IBM'
# two Y axis example
# to plot second Y axis, free some space on left side, set LeftMargin=3
layout(1)
cols = c('black', 'red')
rtsplot(y, type = 'l', LeftMargin=3, col=cols[1])
rtsplot2Y(y1, type='l', las=1, col=cols[2], col.axis=cols[2])
rtsplot.legend('SPY(rhs),IBM(lhs)', cols, list(y,y1))
[Package rtsplot version 0.1.5 Index]