Heatmap

Content Performance Grid

Blog post metrics by category and month

Output
Content Performance Grid
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

np.random.seed(42)

# Categories and months
categories = ['Tech', 'Business', 'Lifestyle', 'Health', 'Finance', 'Travel']
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']

# Pageviews (thousands)
views = np.random.randint(10, 50, (len(categories), len(months)))
# Add trends
views[0, :] = [15, 22, 35, 45, 52, 68]  # Tech growing
views[5, :] = [45, 38, 25, 18, 22, 35]  # Travel seasonal

df = pd.DataFrame(views, index=categories, columns=months)

# NEON amber colormap
neon_amber = LinearSegmentedColormap.from_list('neon_amber', ['#ffffff', '#F5D327', '#F5B027', '#F54927'])

fig, ax = plt.subplots(figsize=(9, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

sns.heatmap(df, cmap=neon_amber, annot=True, fmt='d', linewidths=2, linecolor='#ffffff',
            annot_kws={'size': 12, 'fontweight': 'bold'},
            cbar_kws={'shrink': 0.8, 'label': 'Pageviews (K)'}, ax=ax)

ax.set_title('Content Performance by Category', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Month', color='#1f2937', fontsize=11)
ax.set_ylabel('Category', color='#1f2937', fontsize=11)
ax.tick_params(colors='#374151', labelsize=11)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Heatmaps & Density

Did this help you?

Support PyLucid to keep it free & growing

Support