ANOVA Boxplot

E-commerce Page Speed ANOVA

Comparing page load times across major e-commerce platforms.

Output
E-commerce Page Speed ANOVA
Python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats

np.random.seed(1010)

# Page load time in seconds
amazon = np.random.lognormal(0.6, 0.35, 150)
ebay = np.random.lognormal(0.9, 0.4, 150)
walmart = np.random.lognormal(0.8, 0.38, 150)
target = np.random.lognormal(0.75, 0.36, 150)
etsy = np.random.lognormal(0.7, 0.32, 150)

amazon = np.clip(amazon, 0.8, 6)
ebay = np.clip(ebay, 1.0, 8)
walmart = np.clip(walmart, 0.9, 7)
target = np.clip(target, 0.85, 6.5)
etsy = np.clip(etsy, 0.8, 5.5)

F_stat, p_value = stats.f_oneway(amazon, ebay, walmart, target, etsy)

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

colors = ['#F5B027', '#F5276C', '#276CF5', '#C82909', '#6CF527']
data = [amazon, ebay, walmart, target, etsy]

bp = ax.boxplot(data, positions=[1, 2, 3, 4, 5], widths=0.55, patch_artist=True,
                medianprops={'color': 'white', 'linewidth': 2},
                whiskerprops={'color': '#555555', 'linewidth': 1.5},
                capprops={'color': '#555555', 'linewidth': 1.5},
                flierprops={'marker': '.', 'markerfacecolor': '#666666', 'markersize': 5})

for patch, color in zip(bp['boxes'], colors):
    patch.set_facecolor(color)
    patch.set_alpha(0.7)
    patch.set_edgecolor('white')
    patch.set_linewidth(1.5)

labels = ['Amazon', 'eBay', 'Walmart', 'Target', 'Etsy']

# Google Core Web Vitals thresholds
ax.axhline(y=2.5, color='#22c55e', linestyle='--', alpha=0.6, linewidth=1.5)
ax.axhline(y=4.0, color='#f97316', linestyle='--', alpha=0.6, linewidth=1.5)
ax.text(5.45, 2.5, 'Good', fontsize=7, color='#22c55e', va='center')
ax.text(5.45, 4.0, 'Poor', fontsize=7, color='#f97316', va='center')

# Bounce rate correlation
bounce = ['38%', '52%', '45%', '42%', '35%']
for i, (d, br, color) in enumerate(zip(data, bounce, colors)):
    ax.text(i+1, -0.5, f'Bounce:{br}', ha='center', fontsize=8, color=color)

# Stats header
stats_text = f"ANOVA: F={F_stat:.2f}, p={p_value:.4f} | Fastest: Etsy (μ={etsy.mean():.2f}s)"
bbox = dict(boxstyle="round,pad=0.3", facecolor='#0d1117', edgecolor='#6CF527', lw=2)
ax.text(0.5, 1.02, stats_text, transform=ax.transAxes, fontsize=9, color='white',
        ha='center', va='bottom', fontfamily='monospace', bbox=bbox)

ax.set_xticks([1, 2, 3, 4, 5])
ax.set_xticklabels(labels, fontsize=10, color='white')
ax.set_ylabel('Page Load Time (seconds)', fontsize=12, color='white', fontweight='500')
ax.set_title('E-commerce Platform Performance\nLCP (Largest Contentful Paint) Comparison', 
             fontsize=14, color='white', fontweight='bold', pad=25)

ax.tick_params(colors='#888888')
for spine in ax.spines.values():
    spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_axisbelow(True)
ax.set_ylim(-1, 9)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support