Line & Scatter
Multi-Series Trends
Multiple time series with different growth patterns.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'series_a': '#8B5CF6', # Violet
'series_b': '#06B6D4', # Cyan
'series_c': '#F97316', # Orange
'background': '#FAFBFC',
'text_muted': '#64748B',
'grid': '#E2E8F0',
}
# === DATA ===
x = np.linspace(0, 10, 80)
y_a = 2 + 0.4 * x + 0.5 * np.sin(2 * x)
y_b = 1 + 0.3 * x ** 1.2
y_c = 5 - 0.2 * x + 0.8 * np.cos(1.5 * x)
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
ax.plot(x, y_a, color=COLORS['series_a'], linewidth=2.5, label='Growth A')
ax.plot(x, y_b, color=COLORS['series_b'], linewidth=2.5, label='Growth B')
ax.plot(x, y_c, color=COLORS['series_c'], linewidth=2.5, label='Decline C')
# Markers at key points
ax.scatter([10], [y_a[-1]], color=COLORS['series_a'], s=60, zorder=5, edgecolors='white', linewidths=2)
ax.scatter([10], [y_b[-1]], color=COLORS['series_b'], s=60, zorder=5, edgecolors='white', linewidths=2)
ax.scatter([10], [y_c[-1]], color=COLORS['series_c'], s=60, zorder=5, edgecolors='white', linewidths=2)
# === AXES ===
ax.set_xlim(0, 11)
ax.set_ylim(0, 8)
ax.set_xlabel('Period', fontsize=10, color=COLORS['text_muted'], labelpad=10)
ax.set_ylabel('Value', fontsize=10, color=COLORS['text_muted'], labelpad=10)
# === STYLING ===
for spine in ['top', 'right']:
ax.spines[spine].set_visible(False)
for spine in ['bottom', 'left']:
ax.spines[spine].set_color(COLORS['grid'])
ax.yaxis.grid(True, color=COLORS['grid'], linewidth=0.5, alpha=0.7)
ax.xaxis.grid(False)
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 Line & Scatter examples
☕