2.4 Seasonal plots
A seasonal plot is similar to a time plot except that the data are plotted against the individual “seasons” in which the data were observed. An example is given below showing the antidiabetic drug sales.
%>% gg_season(Cost, labels = "both") + a10 ylab("$ million") + ggtitle("Seasonal plot: antidiabetic drug sales")
These are exactly the same data as were shown earlier, but now the data from each season are overlapped. A seasonal plot allows the underlying seasonal pattern to be seen more clearly, and is especially useful in identifying years in which the pattern changes.
In this case, it is clear that there is a large jump in sales in January each year. Actually, these are probably sales in late December as customers stockpile before the end of the calendar year, but the sales are not registered with the government until a week or two later. The graph also shows that there was an unusually small number of sales in March 2008 (most other years show an increase between February and March). The small number of sales in June 2008 is probably due to incomplete counting of sales at the time the data were collected.
Multiple seasonal periods
Where the data has more than one seasonal pattern, the
period argument can be used to select which seasonal plot is required. The
vic_elec data contains half-hourly electricity demand for the state of Victoria, Australia. We can plot the daily pattern, weekly pattern or yearly pattern as follows.
%>% gg_season(Demand, period="day") + theme(legend.position = "none")vic_elec
%>% gg_season(Demand, period="week") + theme(legend.position = "none")vic_elec
%>% gg_season(Demand, period="year")vic_elec