Line & Scatter
Connected Scatter Path
Scatter points connected by glowing path lines.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'path': '#A855F7', # Purple
'points': '#F59E0B', # Amber
'background': '#0F172A',
'text': '#E2E8F0',
'grid': '#334155',
}
# === DATA ===
np.random.seed(123)
n = 12
t = np.linspace(0, 2 * np.pi, n)
x = 5 + 3 * np.cos(t) + np.random.normal(0, 0.3, n)
y = 4 + 2.5 * np.sin(t) + np.random.normal(0, 0.3, n)
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
# Path with glow
for lw, alpha in [(10, 0.05), (6, 0.1), (3, 0.3), (1.5, 0.7)]:
ax.plot(x, y, color=COLORS['path'], linewidth=lw, alpha=alpha)
# Points with glow
for xi, yi in zip(x, y):
for s, alpha in [(300, 0.08), (150, 0.15), (70, 0.3)]:
ax.scatter([xi], [yi], s=s, color=COLORS['points'], alpha=alpha)
ax.scatter([xi], [yi], s=40, color=COLORS['points'],
edgecolors='white', linewidths=1.5, zorder=5)
# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 8)
ax.set_xlabel('X', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Y', fontsize=10, color=COLORS['text'], labelpad=10)
# === STYLING ===
for spine in ax.spines.values():
spine.set_visible(False)
ax.xaxis.grid(True, color=COLORS['grid'], linewidth=0.5, alpha=0.3)
ax.yaxis.grid(True, color=COLORS['grid'], linewidth=0.5, alpha=0.3)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text'], labelsize=9, length=0, pad=8)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Line & Scatter examples
☕