Get Started

Seasonal plots

Along with time plots, there are other useful ways of plotting data to emphasize seasonal patterns and show changes in these patterns over time.

  • 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. You can create one using the ggseasonplot() function the same way you do with autoplot().
  • An interesting variant of a season plot uses polar coordinates, where the time axis is circular rather than horizontal; to make one, simply add a polar argument and set it to TRUE.
  • A subseries plot comprises mini time plots for each season. Here, the mean for each season is shown as a blue horizontal line.

One way of splitting a time series is by using the window() function, which extracts a subset from the object x observed between the times start and end.

> window(x, start = NULL, end = NULL)

In this exercise, you will load the fpp2 package and use two of its datasets:

  • a10 contains monthly sales volumes for anti-diabetic drugs in Australia. In the plots, can you see which month has the highest sales volume each year? What is unusual about the results in March and April 2008?
  • ausbeer which contains quarterly beer production for Australia. What is happening to the beer production in Quarter 4?

These examples will help you to visualize these plots and understand how they can be useful.

This is a part of the course

“Forecasting in R”

View Course

Exercise instructions

  • Use library() to load the fpp2 package.
  • Use autoplot() and ggseasonplot() to produce plots of the a10 data.
  • Use the ggseasonplot() function and its polar argument to produce a polar coordinate plot for the a10 data.
  • Use the window() function to consider only the ausbeer data starting from 1992.
  • Finally, use autoplot() and ggsubseriesplot() to produce plots of the beer series.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the fpp2 package
___

# Create plots of the a10 data
___
___

# Produce a polar coordinate season plot for the a10 data
ggseasonplot(___, polar = ___)

# Restrict the ausbeer data to start in 1992
beer <- ___(___, ___)

# Make plots of the beer data
___
___

This exercise is part of the course

Forecasting in R

IntermediateSkill Level
4.9+
14 reviews

Learn how to make predictions about the future using time series forecasting in R including ARIMA models and exponential smoothing methods.

The first thing to do in any data analysis task is to plot the data. Graphs enable many features of the data to be visualized, including patterns, unusual observations, and changes over time. The features that are seen in plots of the data must then be incorporated, as far as possible, into the forecasting methods to be used.

Exercise 1: Welcome to Forecasting Using RExercise 2: Creating time series objects in RExercise 3: Time series plotsExercise 4: Seasonal plots
Exercise 5: Trends, seasonality, and cyclicityExercise 6: Autocorrelation of non-seasonal time seriesExercise 7: Autocorrelation of seasonal and cyclic time seriesExercise 8: Match the ACF to the time seriesExercise 9: White noiseExercise 10: Stock prices and white noise

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free