chart_Series with stock history from yahoofinancer

52 Views Asked by At

I am getting an error when I try to make a plot with chart_Series() that works with chartSeries().

I get the data with getSymbols() and can then use chartSeries() to get stock chart:

library(quantmod)
AAPL <- getSymbols("AAPL", from=Sys.Date()-84, auto.assign=F)
chartSeries(AAPL,theme="white",major.ticks="months",minor.ticks = F)

enter image description here

However if I use chart_Series():

chart_Series(AAPL,theme="white",major.ticks="months",minor.ticks=F)

I have the error "Error in theme$col : $ operator is invalid for atomic vectors"

I want to use chart_Series() because it supports the par() function.

How to resolve the error in chart_Series()? Thank you for reading my posts :)

1

There are 1 best solutions below

5
Joshua Ulrich On

chart_Series() does not have the same arguments as chartSeries(), so they're not meant to be drop-in replacements of each other. chart_Series() uses a white background by default, so you don't need to change theme if that is all you want.

library(quantmod)
aapl <- getSymbols("AAPL", periodicity = "1min", auto.assign = FALSE)
chart_Series(aapl)

enter image description here