我的数据是从2010年到2019年的每天时间序列。
我希望在一幅图中绘制折线图,其中包含所有年份一月份的所有日销售量(1-30)。然后是下一个2月的地块,依此类推。我画了一幅画以更好地了解我的问题。
如果我使用facet_wrap或facet_grid函数,则仅用于月份透视。我还每天尝试使用forecast::ggseansonplot()
,但是输出消息是没有季节性。但是我只想绘制一个图,不进行分析。
library(ggplot2)
library(plyr)
library(readxl)
s <- read_excel("sales.xlsx")
s$date <- as.Date(s$date)
s$month <- as.Date(cut(s$date,breaks="month"))
base <- ggplot(s,aes(date,sales)) +
geom_line()
base + facet_wrap(~month,ncol=6)
感谢您的帮助
Steph