Scatter Plot
Strip Plot
Categorical scatter with jitter and mean indicators.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'cat1': '#6366F1',
'cat2': '#10B981',
'cat3': '#F59E0B',
'cat4': '#EF4444',
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9',
}
# === DATA ===
np.random.seed(42)
categories = ['Q1', 'Q2', 'Q3', 'Q4']
data = [np.random.normal(50, 10, 30) + i*5 for i in range(4)]
colors = [COLORS['cat1'], COLORS['cat2'], COLORS['cat3'], COLORS['cat4']]
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
for i, (cat, vals, color) in enumerate(zip(categories, data, colors)):
x_jitter = np.random.uniform(-0.2, 0.2, len(vals))
# Glow
ax.scatter([i]*len(vals) + x_jitter, vals, s=150, c=color, alpha=0.15, zorder=1)
# Points
ax.scatter([i]*len(vals) + x_jitter, vals, s=50, c=color, alpha=0.8,
edgecolors='white', linewidths=1.5, zorder=2)
# Mean line
ax.hlines(np.mean(vals), i-0.3, i+0.3, colors=color, linewidth=2, zorder=3)
# === STYLING ===
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color(COLORS['grid'])
ax.spines['bottom'].set_color(COLORS['grid'])
ax.yaxis.grid(True, color=COLORS['grid'], linewidth=1)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)
ax.set_xticks(range(4))
ax.set_xticklabels(categories)
ax.set_ylabel('Performance Score', fontsize=10, color=COLORS['text'], labelpad=10)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Scatter Plot examples
☕