Seasonal Plots#

Seasonal plots visualize and detect seasonality in a time series. Based on a selected periodicity they emphasize the seasonal patterns and show changes over time.

This example demonstrates four seasonal plot types using monthly heating energy data of a flat over ~10 years.

All plots are interactive — hover to see exact values.

import plotly.io as pio
pio.renderers.default = "notebook_connected"
import pandas as pd
from importlib import resources

data_path = resources.files("pyedautils") / "data" / "seasonal_monthly.csv"
df = pd.read_csv(data_path, sep=";")
df.head()
timestamp value
0 2010-01-01 19.000000
1 2010-02-01 19.642857
2 2010-03-01 17.032258
3 2010-04-01 8.633333
4 2010-05-01 0.870968

Overlapping#

One line per year, all overlaid on the same month axis. Double-click on a year in the legend to isolate it.

from pyedautils.plots import plot_seasonal_overlapping

fig = plot_seasonal_overlapping(
    data=df,
    title="Seasonal Overlapping (10 Years)",
    ylab="Avg Daily Energy (kWh/day)",
)
fig.show()

Miniplots#

One mini panel per month showing how the value changes across years. The blue horizontal line is the per-month mean.

from pyedautils.plots import plot_seasonal_miniplots

fig = plot_seasonal_miniplots(
    data=df,
    title="Seasonal Miniplots (10 Years)",
    ylab="Avg Daily Energy (kWh/day)",
)
fig.show()

Before/After Optimization#

Years before the optimization (Sep 2017) are shown in grey with a confidence band; years after are highlighted in colour.

from pyedautils.plots import plot_seasonal_before_after

fig = plot_seasonal_before_after(
    data=df,
    date_optimization="2017-09-01",
    title="Before/After Energy Optimization",
    ylab="Avg Daily Energy (kWh/day)",
)
fig.show()

Polar#

Same as overlapping, but in polar coordinates. Emphasizes the high summer consumption that was reduced after 2017.

from pyedautils.plots import plot_seasonal_polar

fig = plot_seasonal_polar(
    data=df,
    title="Seasonal Polar (10 Years)",
    ylab="Avg Daily Energy (kWh/day)",
)
fig.show()