Scatter Plot
Glow Bubble Scatter
Multi-category scatter with glowing halo effect and modern color palette.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'primary': '#6366F1', # Indigo
'secondary': '#EC4899', # Pink
'accent': '#10B981', # Emerald
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9',
}
# === DATA ===
np.random.seed(42)
n = 30
x = np.random.uniform(1, 9, n)
y = np.random.uniform(1, 9, n)
sizes = np.random.uniform(150, 600, n)
categories = np.random.choice([0, 1, 2], n)
palette = [COLORS['primary'], COLORS['secondary'], COLORS['accent']]
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
# Glow layers (halo effect)
for alpha, scale in [(0.03, 2.5), (0.05, 2.0), (0.08, 1.5)]:
for cat in [0, 1, 2]:
mask = categories == cat
ax.scatter(x[mask], y[mask], s=sizes[mask] * scale,
c=palette[cat], alpha=alpha, zorder=1)
# Main points
for cat, label in zip([0, 1, 2], ['Alpha', 'Beta', 'Gamma']):
mask = categories == cat
ax.scatter(x[mask], y[mask], s=sizes[mask], c=palette[cat],
alpha=0.8, edgecolors='white', linewidths=2,
label=label, zorder=3)
# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
ax.set_xlabel('Dimension X', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Dimension Y', fontsize=10, color=COLORS['text'], labelpad=10)
# === 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.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12),
ncol=3, frameon=False, fontsize=9, labelcolor=COLORS['text_muted'])
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Scatter Plot examples
☕