Line & Scatter
Gradient Multi-Series
Multiple series with gradient color progression.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
# Gradient from cyan to violet
GRADIENT = ['#06B6D4', '#0EA5E9', '#6366F1', '#8B5CF6', '#A855F7']
COLORS = {
'background': '#0F172A',
'text': '#E2E8F0',
'grid': '#334155',
}
# === DATA ===
x = np.linspace(0, 10, 100)
n_lines = 5
lines_y = [2 + i * 1.2 + np.sin(x + i * 0.5) for i in range(n_lines)]
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
for i, (y, color) in enumerate(zip(lines_y, GRADIENT)):
# Glow
ax.plot(x, y, color=color, linewidth=6, alpha=0.15)
ax.plot(x, y, color=color, linewidth=3, alpha=0.3)
# Main line
ax.plot(x, y, color=color, linewidth=2, label=f'Series {i+1}')
# End marker
ax.scatter([x[-1]], [y[-1]], color=color, s=50,
edgecolors='white', linewidths=1.5, zorder=5)
# === AXES ===
ax.set_xlim(0, 11)
ax.set_ylim(0, 12)
ax.set_xlabel('Time', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Value', 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.3)
ax.xaxis.grid(False)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text'], labelsize=9, length=0, pad=8)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12),
ncol=5, frameon=False, fontsize=9, labelcolor=COLORS['text'])
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Line & Scatter examples
☕