使用ggplot2绘制时间序列数据

Vic*_*han 5 r time-series ggplot2 lubridate

我正在做一个项目,需要使用 ggplot2 来绘制时间序列数据。这是我正在使用的数据集:

欧元

这就是我现在所做的:

library(ggplot2)
library(lubridate)
eur$Date <- as.Date(eur$Date)
ggplot(eur, aes(Date, EUR)) + geom_line()
Run Code Online (Sandbox Code Playgroud)

阴谋

我得到了这个非常奇怪的情节。有人可以帮我解决这个问题吗?

111*_*111 0

那么你需要扩展你的数据。您能否详细说明一下数据的样子。这种格式可能对您有帮助。不过我需要更好地理解数据

library(ggplot2)
library(lubridate)  
ggplot( aes(Date, EUR)) + geom_line() +
scale_x_date(format = "%b-%Y") + xlab("") + ylab("")
Run Code Online (Sandbox Code Playgroud)