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 :
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"))
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)