import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = 5 * x + 10
m, b = np.polyfit(x, y, 1)
plt.plot(x, y, '.')
plt.plot(x, m * x + b, '-')
How to overplot a line on a scatter plot in python?