#!/usr/bin/env python import numpy as np from scipy import interpolate import matplotlib.pyplot as plt def noise(nnodes): x = np.linspace(0, 1, nnodes) y = np.random.uniform(-1, +1, nnodes) return interpolate.interp1d(x, y, kind='cubic') f = noise(5) x = np.linspace(0, 1, 100) with plt.style.context('ggplot'): plt.plot(x, f(x)) plt.savefig('src01.png')