import matplotlib.pyplot as pl import numpy as np x = np.linspace(1, 10) def f(x): return np.sin(x) + np.random.normal(scale=0.1, size=len(x)) pl.plot(x, f(x))