Skip to content
Insider Magazin
Resources

Visualization · 9 min read

Visualizing Time-Series Data

Aggregation, trailing moving averages, seasonality, year-over-year overlays, heatmaps and log scales: how to chart time-stamped data so the picture reflects the data rather than the charting choices, and the dual-axis traps to avoid.

Introduction

A time series is a sequence of observations indexed by time. Plotting one seems straightforward: dates on the horizontal axis, values on the vertical axis, a line joining the points. In practice, the same data can produce very different pictures depending on how values are aggregated, smoothed and scaled. Daily data over three years contain more than a thousand points per series, and a raw line chart of them is usually dominated by noise.

This article covers the main decisions in time-series visualization: the level of aggregation, smoothing with moving averages, separating trend from seasonality, and the choice of chart type and scale. Each technique answers a different question, and each can mislead if it is applied without thought.

Aggregation: choosing the time grain

Aggregation groups observations into calendar periods (day, week, month, quarter) and summarizes each period with one number. Coarser periods reduce noise and reveal long-term movement, but they also hide short-term structure such as weekly cycles or brief disruptions. A good habit is to start coarse to see the trend, then move to finer grains to see what the trend conceals.

Mean or total?

For flows such as demand or sales, monthly totals depend on the number of days in the month and on how many of those days have data. Monthly means per observation remove both effects. The Insider Magazin time series aggregates by the mean per period for this reason. When a period is thinly populated, its mean rests on few observations and deserves less weight in your reading of the chart.

Averages of averages

When aggregating further, compute the mean from the underlying observations, not from the period means. Suppose January has 31 observations with mean 100 and February has only 10 observations (because of a data gap) with mean 130.

pooled mean = (31 × 100 + 10 × 130) / 41 = 4,400 / 41 ≈ 107.3
The mean of the 41 observations. The unweighted mean of the two monthly means would be 115.

The difference of nearly 8 units is purely an artefact of averaging averages. Recomputing from observations, as the workspace does at every grain, gives each observation equal weight.

Calendar edges

Periods at the edges of a date range are often incomplete. ISO weeks start on Monday, so a range beginning on Sunday 1 January 2023 has a first weekly point based on a single day, and a range ending on Wednesday 31 December 2025 has a final weekly point based on three. Partial periods are noisier and, for data with a weekly cycle, biased. Check the observation count before interpreting the first and last points of an aggregated series.

Moving averages

A moving average replaces each point with the mean of a window of neighbouring points. The workspace uses a trailing moving average: each value is the mean of the current period and the k − 1 periods before it.

MAₜ = (xₜ + xₜ₋₁ + … + xₜ₋ₖ₊₁) / k
Trailing moving average with window k. Undefined for the first k − 1 points.
t12345678910
xₜ40423945474450524955
MA₃––40.3342.0043.6745.3347.0048.6750.3352.00
Three-period trailing moving average. For example, MA₃ at t = 4 is (42 + 39 + 45) / 3 = 42.00.

The smoothed line is clearly calmer than the raw values, which jump up and down by several units. Three properties are worth keeping in mind:

  • Lag. A trailing average reacts late. On a steadily rising series it lags the data by (k − 1) / 2 periods; with a 7-day window that is 3 days, with a 30-day window 14.5 days. In the example the values rise by about 1.7 units per period on average (from 40 to 55 over nine steps), so the three-period average runs roughly one period, or about 1.7 units, behind the underlying trend. A centred moving average removes this lag but needs future values, so it cannot be computed for the most recent points.
  • Undefined start. The first k − 1 points have no complete window. The workspace leaves them empty rather than averaging over fewer points, which would make the early part of the line noisier than the rest.
  • Window choice. A window equal to the length of a cycle removes that cycle: a 7-day window on daily data cancels a weekly pattern, a 12-month window on monthly data cancels annual seasonality. A window that is not a multiple of the cycle leaves residual ripples.

Note that the window counts points, not calendar days. If days are missing, a 7-point window on daily data spans more than a week. Check coverage before interpreting a smoothed line over a period with gaps.

Seasonality and year-over-year overlays

Many series combine a long-term trend with repeating patterns: annual (heating demand peaks in winter), weekly (lower activity at weekends) or both. On a single long line chart, a strong seasonal cycle can make it hard to see whether this year is higher or lower than last year.

A year-over-year overlay solves this by plotting each year as its own line against a shared January-to-December axis. Seasonal shape becomes visible as the common profile of the lines, and the trend appears as a vertical offset between them. If every line peaks in January and each year sits slightly above the previous one, you are looking at a seasonal series with an upward trend. The illustrative electricity-demand dataset in the workspace has exactly this structure: a winter peak and a modest upward trend.

Overlay monthly means rather than daily values. Day-of-year alignment compares different weekdays in different years (1 March was a Friday in 2024 and a Saturday in 2025), which introduces artificial differences for any series with a weekly cycle.

Autocorrelation

Values in a time series are rarely independent of their neighbours. A lag-1 scatter plot, with each day's value plotted against the previous day's, makes this visible. Points clustered along a rising diagonal indicate strong positive autocorrelation, and the Pearson correlation r of the pairs summarizes it. For independent observations r would be close to zero. High autocorrelation is a reminder that a long series contains less independent information than its length suggests.

Heatmaps for two calendar dimensions

When a series has two overlapping cycles, a calendar heatmap often communicates better than any line chart. A weekday × month heatmap has seven rows and twelve columns; each cell is coloured by the mean value of all observations falling on that weekday in that month. A weekend effect appears as two distinct rows, a seasonal effect as a gradient across columns, and an interaction (for example, a weekend effect that is stronger in summer) as a change in contrast between rows from one column to another.

Each cell is an average over relatively few days. Every month contains four or five of each weekday, so three years of daily data give about 12 to 15 observations per cell for each series. Cells with few observations are noisy; a good heatmap makes cell counts available, for instance in a tooltip.

Colour scales need care. Use a sequential scale (light to dark in one hue) for values with a natural low-to-high order, and a diverging scale only when there is a meaningful midpoint such as zero change. Rainbow scales distort perceived differences because lightness does not vary monotonically.

Scales: logarithmic axes and the dual-axis problem

Logarithmic scales

On a logarithmic axis, equal vertical distances represent equal ratios rather than equal differences. A rise from 10 to 20 and a rise from 1,000 to 2,000 both double the value, and both cover log₁₀ 2 ≈ 0.301 units of height. On a linear axis the first would be invisible next to the second.

log₁₀(x₂) − log₁₀(x₁) = log₁₀(x₂ / x₁)
Vertical distance on a log axis depends only on the ratio of the values.

Use a log scale when values span several orders of magnitude, when growth is multiplicative (a constant percentage growth rate becomes a straight line), or when comparing relative changes across series of very different size. Do not use it when the audience will read the chart as linear, and never for data that include zero or negative values, which have no logarithm. Always label the axis so the scale is unmistakable.

Dual axes

Charts with two vertical axes, one for each series, are common and almost always misleading. The visual relationship between the two lines depends entirely on how each axis is scaled, and those scales are arbitrary. By choosing ranges, the same two series can be made to cross, run in parallel or diverge. Readers inevitably interpret crossings and parallel movement as meaningful.

Better alternatives: index both series to 100 at a common start date and plot them on one axis; plot them in two vertically stacked panels with a shared time axis; or, if the relationship itself is the point, use a scatter plot of one against the other.

Common pitfalls

Check the frame before reading the picture

Most misleading time-series charts are not wrong in their data but in their framing: a truncated y-axis that turns a 2% change into a dramatic slope, a start date chosen at a seasonal low, a smoothing window that hides a recent break, or a second axis scaled to create a correlation. Before drawing a conclusion, change the date range, the grain and the smoothing, and see whether the conclusion survives.

  • Interpolating across gaps. A line drawn straight across missing data suggests values that were never observed.
  • Comparing a partial period with full ones. The current month or year to date is not comparable to complete periods in total terms.
  • Mixing time zones. Observations near midnight move between days, and those near month-end between months. Use a single convention, such as UTC calendar days.
  • Mistaking a smoothed line for a forecast. A moving average describes recent history. Extending it forward is a prediction with no stated uncertainty.

Time-series views in the workspace

The Insider Magazin time series aggregates by day, ISO week, month or quarter (mean per period), overlays a trailing moving average with a selectable window, and offers a zoom slider for long ranges. The historical-trends view adds the year-over-year monthly profile, the weekday × month heatmap of mean values, and the lag-1 scatter plot with Pearson r. All dates are UTC calendar days.

Try different grains and windows on the illustrative electricity-demand dataset in the interactive demo. The aggregation and smoothing rules are specified in the methodology, and the documentation walks through each chart.

Bring clarity to your analytical workflow.

See the workspace with your own questions in mind. A walkthrough takes about 30 to 45 minutes and is followed by a written proposal if the platform is a fit.