0

I'm new to ggplot and, while this seems like a simple question, I'm baffled. I get the error message

Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.

And I don't see a line on my graph. Here's the output : ggplot output Here's my code:

> library(quantmod)
> library(TTR)
> library(ggplot2)
> getSymbols("SPY")
[1] "SPY"
> price<-SPY[,1]
> ggplot(price,aes(x=time(price),y=price),geom_line(color="blue"))
Richard Telford
  • 9,558
  • 6
  • 38
  • 51
S Novogoratz
  • 388
  • 2
  • 14

1 Answers1

0

zoo provides autoplot.zoo to plot xts/zoo objects with ggplot2:

autoplot(price, col = I("blue")) + ggtitle("SPY")

Also check out chart_Series (from quantmod) which uses classic graphics:

chart_Series(SPY)
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341