Line & Scatter
Flowing Ribbons
Multiple flowing lines creating a ribbon effect.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'ribbon': '#EC4899', # Pink
'background': '#0F172A',
'text': '#E2E8F0',
'grid': '#334155',
}
# === DATA ===
x = np.linspace(0, 10, 200)
n_ribbons = 8
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
for i in range(n_ribbons):
phase = i * 0.3
amplitude = 0.8 + 0.3 * np.sin(i * 0.5)
y = 4 + amplitude * np.sin(x + phase) + i * 0.15
alpha_base = 0.15 + 0.1 * (i / n_ribbons)
# Glow
ax.plot(x, y, color=COLORS['ribbon'], linewidth=4, alpha=alpha_base * 0.5)
ax.plot(x, y, color=COLORS['ribbon'], linewidth=2, alpha=alpha_base)
ax.plot(x, y, color='white', linewidth=0.5, alpha=alpha_base * 0.8)
# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 8)
ax.set_xlabel('Flow', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Stream', fontsize=10, color=COLORS['text'], labelpad=10)
# === STYLING ===
for spine in ax.spines.values():
spine.set_visible(False)
ax.yaxis.grid(True, color=COLORS['grid'], linewidth=0.5, alpha=0.2)
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
☕