Heatmap
Website Heatmap by Day and Hour
Seamless traffic heatmap showing website visits patterns
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
fig, ax = plt.subplots(figsize=(14, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
np.random.seed(42)
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
hours = [f'{h}:00' for h in range(24)]
data = np.random.poisson(500, (len(days), len(hours)))
data[5:7, 10:18] += 300
data[0:5, 9:12] += 400
data[0:5, 14:17] += 350
# Modern gradient: Cool Indigo to Electric Violet to Hot Pink
colors = ['#eef2ff', '#a5b4fc', '#818cf8', '#7c3aed', '#c026d3', '#f472b6']
cmap = LinearSegmentedColormap.from_list('modern', colors, N=256)
im = ax.imshow(data, cmap=cmap, aspect='auto')
ax.set_xticks(range(0, len(hours), 2))
ax.set_yticks(range(len(days)))
ax.set_xticklabels([hours[i] for i in range(0, len(hours), 2)], rotation=45, ha='right', color='#374151', fontsize=9)
ax.set_yticklabels(days, color='#1f2937', fontsize=10, fontweight='500')
cbar = plt.colorbar(im, ax=ax, shrink=0.8, pad=0.02)
cbar.set_label('Visitors', color='#1f2937', fontsize=11)
cbar.outline.set_edgecolor('#e5e7eb')
plt.setp(plt.getp(cbar.ax.axes, 'yticklabels'), color='#6b7280')
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
ax.set_xlabel('Hour of Day', fontsize=11, color='#374151', fontweight='500')
ax.set_title('Website Traffic Patterns', fontsize=16, color='#111827', fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Heatmaps & Density
More Heatmap examples
☕