ANOVA Boxplot
Mobile App Store Ratings ANOVA
Comparing user ratings across different app categories.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
np.random.seed(1919)
# App store ratings (1-5)
games = np.random.normal(4.1, 0.5, 120)
productivity = np.random.normal(4.3, 0.4, 120)
social = np.random.normal(3.8, 0.6, 120)
health = np.random.normal(4.4, 0.35, 120)
finance = np.random.normal(4.0, 0.55, 120)
games = np.clip(games, 2.5, 5.0)
productivity = np.clip(productivity, 3.0, 5.0)
social = np.clip(social, 2.0, 5.0)
health = np.clip(health, 3.2, 5.0)
finance = np.clip(finance, 2.5, 5.0)
F_stat, p_value = stats.f_oneway(games, productivity, social, health, finance)
fig, ax = plt.subplots(figsize=(13, 7), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
colors = ['#F5276C', '#27D3F5', '#F5B027', '#6CF527', '#4927F5']
data = [games, productivity, social, health, finance]
bp = ax.boxplot(data, positions=[1, 2, 3, 4, 5], widths=0.55, patch_artist=True,
medianprops={'color': '#1f2937', 'linewidth': 2},
whiskerprops={'color': '#9ca3af', 'linewidth': 1.5},
capprops={'color': '#9ca3af', 'linewidth': 1.5},
flierprops={'marker': 'o', 'markerfacecolor': '#d1d5db', 'markersize': 4})
for patch, color in zip(bp['boxes'], colors):
patch.set_facecolor(color)
patch.set_alpha(0.6)
patch.set_edgecolor(color)
patch.set_linewidth(2)
labels = ['Games', 'Productivity', 'Social', 'Health', 'Finance']
# Featured threshold
ax.axhline(y=4.5, color='#22c55e', linestyle='--', alpha=0.6, linewidth=1.5)
ax.text(5.45, 4.5, 'Featured', fontsize=7, color='#22c55e', va='center')
# Review counts
reviews = ['1.2M', '450K', '2.1M', '380K', '620K']
for i, (d, rev, color) in enumerate(zip(data, reviews, colors)):
ax.text(i+1, 1.8, f'μ={d.mean():.2f} | {rev}', ha='center', fontsize=8, color=color)
# Stats header
stats_text = f"ANOVA: F={F_stat:.2f}, p={p_value:.4f} | Highest Rated: Health & Fitness (μ={health.mean():.2f})"
bbox = dict(boxstyle="round,pad=0.3", facecolor='#ecfdf5', edgecolor='#6CF527', lw=2)
ax.text(0.5, 1.02, stats_text, transform=ax.transAxes, fontsize=9, color='#1f2937',
ha='center', va='bottom', fontfamily='monospace', bbox=bbox)
ax.set_xticks([1, 2, 3, 4, 5])
ax.set_xticklabels(labels, fontsize=10, color='#1f2937')
ax.set_ylabel('Average Rating (★)', fontsize=12, color='#1f2937', fontweight='500')
ax.set_title('App Store Category Ratings\niOS App Store Analysis',
fontsize=14, color='#1f2937', fontweight='bold', pad=25)
ax.tick_params(colors='#374151')
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
ax.yaxis.grid(True, color='#f3f4f6', linewidth=0.8)
ax.set_axisbelow(True)
ax.set_ylim(1.5, 5.1)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More ANOVA Boxplot examples
☕