I have the following code:
library(ggplot2)
library(fpp2)
library(tidyverse)
library(tidyr)
library(lubridate)
library(writexl)
library(plyr)
library(forecast)
Sales171819 <- SalesNL[SalesNL$TransactionDate >= "2017-01-01" & SalesNL$TransactionDate <= "2019-12-31",]
#create time series
myts <- ts(Sales171819[,2],start = decimal_date(as.Date("2017-05-01")), frequency = 365)
#plot time series
view(myts)
autoplot(myts) + ggtitle("TAF Sales NL 2017/2018")+
ylab("SalesQty") + xlab("days")
# seasonal plot sales
ggseasonplot(myts) + ggtitle("Sales Per Dag")+
ylab("Sales") + xlab("Days")
I would like to plot the actual dates to the autoplot and ggseasonplot on the x axis, instead of day 1, 2, 3... etc. I would also like to highlight points in the plots with the actual dates. How can I edit my code so I can get this done?
The data looks like this:
TransactionDate NetSalesQty
1 2017-05-01 1221
2 2017-05-02 1275
3 2017-05-03 1198
4 2017-05-04 1792
5 2017-05-05 1842
6 2017-05-06 1183
structure(list(TransactionDate = structure(c(17287, 17288, 17289,
17290, 17291, 17292), class = "Date"), NetSalesQty = c(1221,
1293, 1525, 1475, 1854, 2189)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
Thanks in advance.