%matplotlib inline import numpy as np import matplotlib.pyplot as plt f = [822, 693, 547, 518] y = f v = [1.7, 1.28, .67, .395] df = np.array([.5, 5, 2, 1]) dv = np.array([.01, .01, .01, .05]) fit = np.polyfit(v, f, deg=1) def f(x,fit): return fit[0] * x + fit[1] xfit = np.linspace(0,2) plt.errorbar(v, y, yerr=df, fmt=".k") plt.plot(xfit, f(xfit, fit))