Treemap

Website Traffic Sources Analysis

Dark-themed treemap visualizing website traffic distribution across different acquisition channels including organic, paid, social, and referral sources.

Output
Website Traffic Sources Analysis
Python
import matplotlib.pyplot as plt
import squarify
import numpy as np

# Traffic sources (sessions in thousands)
labels = ['Organic Search', 'Direct', 'Paid Search', 'Social Media',
          'Email', 'Referral', 'Display Ads', 'Affiliates']
sizes = [450, 280, 190, 165, 120, 85, 55, 40]
total = sum(sizes)

# CLAUDE.md colors
colors = ['#6CF527', '#27D3F5', '#F5B027', '#F5276C', 
          '#5314E6', '#276CF5', '#F54927', '#27F5B0']

fig, ax = plt.subplots(figsize=(12, 8), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

pct = [s/total*100 for s in sizes]
squarify.plot(sizes=sizes, 
              label=[f'{l}\n{s}K ({p:.1f}%)' for l, s, p in zip(labels, sizes, pct)],
              color=colors, alpha=0.85, ax=ax,
              text_kwargs={'fontsize': 10, 'color': 'white', 'fontweight': 'bold'})

ax.axis('off')
ax.set_title(f'Website Traffic Sources - {total/1000:.2f}M Sessions', 
             fontsize=18, color='#f8fafc', fontweight='bold', pad=20)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support