import numpy as np
from dtk.process import spline_over_nan

x = np.linspace(0.0, 2.0, num=201)
y = np.sin(3*2*np.pi*x) + np.random.normal(0.0, 0.1, size=len(x))

y[78:89] = np.nan
y[95:102] = np.nan
y[189:192] = np.nan

y_splined = spline_over_nan(x, y)

fig, ax = plt.subplots(layout='constrained')
ax.fill_between(x, np.min(y_splined) - 0.5, np.max(y_splined) + 0.5,
                where=np.isnan(y), alpha=0.5, color='grey',
                transform=ax.get_xaxis_transform())
ax.plot(x, y_splined, linewidth=4, color='black', label='Filled')
ax.plot(x, y, linestyle='', marker='o', color='red', label='Missing')
ax.legend()