Scatter Plot
Bubble Correlation Matrix
Matrix showing correlation strength with bubble size.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'positive': '#10B981',
'negative': '#EF4444',
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9',
}
# === DATA ===
np.random.seed(42)
labels = ['A', 'B', 'C', 'D', 'E']
n = len(labels)
values = np.random.uniform(-1, 1, (n, n))
sizes = np.abs(values) * 800
# === FIGURE ===
fig, ax = plt.subplots(figsize=(8, 8), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
for i in range(n):
for j in range(n):
color = COLORS['positive'] if values[i,j] > 0 else COLORS['negative']
# Glow
ax.scatter(j, i, s=sizes[i,j]*1.5, c=color, alpha=0.15, zorder=1)
# Point
ax.scatter(j, i, s=sizes[i,j], c=color, alpha=0.8,
edgecolors='white', linewidths=2, zorder=2)
# === STYLING ===
ax.set_xticks(range(n))
ax.set_yticks(range(n))
ax.set_xticklabels(labels)
ax.set_yticklabels(labels)
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.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=10, length=0, pad=8)
ax.set_xlim(-0.5, n-0.5)
ax.set_ylim(-0.5, n-0.5)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Scatter Plot examples
☕