import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.scatter(x, y, label='Data') ax.plot(x, y_pred, label='Linear Regression Fit') plt.show()