ggplot time series, error:Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous

ggplot time series, error:Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous

我是 ggplot 的新手,虽然这看起来是一个简单的问题,但我感到困惑。我收到错误消息

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

而且我在图表上看不到一条线。这是输出: 这是我的代码:

> 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 提供 autoplot.zoo 以使用 ggplot2 绘制 xts/zoo 对象:

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

另请查看使用经典图形的 chart_Series(来自 quantmod):

chart_Series(SPY)