Three.js 3D Heat Map (Hour × Day Calendar)
A full year of hourly data as a 3D heat map in Three.js, with 8,760 cells as instanced bars or a displaced surface, perceptual colour maps, smoothing, and datasets showing daily, weekly and seasonal cycles.
Key topics: 3d heatmap, calendar heatmap, three.js heat map, time series visualization, viridis, instancedmesh
Game Over
What this code does
- Layout: x is day of year, z is hour of day, and height and colour both encode the value.
- Instancing: 8,760 boxes in one InstancedMesh, or a single PlaneGeometry displaced per vertex for a smooth surface.
- Colour Maps: viridis and inferno are perceptually uniform sequential maps; anomaly data uses a diverging blue–red map centred on zero.
- Patterns: evening peaks and weekends in web traffic, office-hours plateaus in energy use, and seasonal swings in temperature.
- Smoothing: averaging ±N days for the same hour isolates the seasonal signal from daily noise.
- Controls: dataset, colour map, bars or surface, height scale and smoothing; hover to read a cell.
Related Demos
Continue Learning
JavaScript Implementation
// 8,760 cells (hour × day) as one InstancedMesh: height and colour encode the value
const bars = new THREE.InstancedMesh(new THREE.BoxGeometry(w, 1, d).translate(0, 0.5, 0), new THREE.MeshStandardMaterial(), 24 * 365)
for (let day = 0; day < 365; day++) for (let hour = 0; hour < 24; hour++) {
const t = (value[day][hour] - min) / (max - min)
bars.setMatrixAt(i, new THREE.Matrix4().makeScale(1, 0.02 + t * 3, 1).setPosition(x(day), 0, z(hour)))
bars.setColorAt(i++, viridis(t)) // perceptually uniform sequential map
}