How to overplot a line on a scatter plot in python?

前端 未结 7 1946
轻奢々
轻奢々 2020-11-28 02:18

I have two vectors of data and I\'ve put them into matplotlib.scatter(). Now I\'d like to over plot a linear fit to these data. How would I do this? I\'ve tried

7条回答
  •  广开言路
    2020-11-28 03:13

    plt.plot(X_plot, X_plot*results.params[0] + results.params[1])
    

    versus

    plt.plot(X_plot, X_plot*results.params[1] + results.params[0])
    

提交回复
热议问题