TidyTuesday (2026) Week 13: Coastal Ocean Temperature by Depth
This week we’re exploring over 7 years of daily coastal ocean temperatures at 7 depths from a location in Nova Scotia, Canada. The data was collected through the Centre for Marine Applied Research’s Coastal Monitoring Program. This and related data sets can be downloaded from the Nova Scotia Open Data Portal.
TidyTuesday
Data Visualization
Python Programming
2026
Author
Peter Gray
Published
March 25, 2026
A heatmap of Nova Scotia Ocean Temps over time
1. Python code
Show code
import pandas as pdimport numpy as npimport plotly.express as pxocean_temperature = pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-03-31/ocean_temperature.csv')ocean_temperature_deployments = pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-03-31/ocean_temperature_deployments.csv')df = ocean_temperaturedf['date'] = pd.to_datetime(df['date'])df['month'] = df['date'].dt.strftime('%B')df['year'] = df['date'].dt.strftime('%Y')summary = df.groupby(['month', 'year']).agg (mean = ("mean_temperature_degree_c", "mean")).reset_index()month_order = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']summary['month'] = pd.Categorical(summary['month'], categories= month_order, ordered =True)summary = summary.sort_values(['year', 'month']).reset_index(drop=True)pivot = summary.pivot(index ="month", columns="year", values='mean' ).round(2)fig = px.imshow(pivot, labels =dict(x ="Year", y ="Month", color="Mean Temp (°C)"), color_continuous_scale="RdBu_r", aspect="auto", text_auto=True, title ="Mean Temperature of Nova Scotia Ocean", width=500, height=500)fig.show()