Area Chart

Smoothed Spline Area

Cubic interpolation for ultra-smooth curves.

Output
Smoothed Spline Area
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import make_interp_spline

# Data
np.random.seed(42)
x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
y = np.array([2, 3, 5, 4, 6, 8, 7, 9, 8, 10, 9])

# Smooth interpolation
x_smooth = np.linspace(x.min(), x.max(), 300)
spl = make_interp_spline(x, y, k=3)
y_smooth = spl(x_smooth)

# Figure - DARK THEME
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

# Smooth area with NEON mint
ax.fill_between(x_smooth, 0, y_smooth, alpha=0.4, color='#27F5B0')
ax.plot(x_smooth, y_smooth, color='#27F5B0', linewidth=2.5)
ax.scatter(x, y, color='#F5276C', s=60, zorder=5, edgecolors='white', linewidth=1)

# Styling
ax.set_xlabel('Time', color='white', fontsize=11)
ax.set_ylabel('Value', color='white', fontsize=11)
ax.set_title('Cubic Spline Interpolation', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
    spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_xlim(0, 10)
ax.set_ylim(0, 12)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support