Scatter Plot
Quadrant Analysis
BCG matrix style quadrant scatter with color-coded segments.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'q1': '#10B981', # High-High (Emerald)
'q2': '#F59E0B', # Low-High (Amber)
'q3': '#EF4444', # Low-Low (Red)
'q4': '#3B82F6', # High-Low (Blue)
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9',
'divider': '#CBD5E1',
}
# === DATA ===
np.random.seed(42)
x = np.random.uniform(0, 100, 40)
y = np.random.uniform(0, 100, 40)
# Assign colors by quadrant
colors = []
for xi, yi in zip(x, y):
if xi >= 50 and yi >= 50: colors.append(COLORS['q1'])
elif xi < 50 and yi >= 50: colors.append(COLORS['q2'])
elif xi < 50 and yi < 50: colors.append(COLORS['q3'])
else: colors.append(COLORS['q4'])
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
# Quadrant dividers
ax.axhline(50, color=COLORS['divider'], linewidth=1, linestyle='--', zorder=1)
ax.axvline(50, color=COLORS['divider'], linewidth=1, linestyle='--', zorder=1)
# Glow
for xi, yi, c in zip(x, y, colors):
ax.scatter(xi, yi, s=200, c=c, alpha=0.15, zorder=2)
# Points
ax.scatter(x, y, s=100, c=colors, alpha=0.8,
edgecolors='white', linewidths=1.5, zorder=3)
# Quadrant labels
for pos, label in [((75, 85), 'Stars'), ((25, 85), 'Question Marks'),
((25, 15), 'Dogs'), ((75, 15), 'Cash Cows')]:
ax.annotate(label, pos, fontsize=9, ha='center',
color=COLORS['text_muted'], alpha=0.8)
# === 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.set_xlim(0, 100)
ax.set_ylim(0, 100)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)
ax.set_xlabel('Market Share', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Growth Rate', fontsize=10, color=COLORS['text'], labelpad=10)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Scatter Plot examples
☕