水平方向的 Polyfit 度数

Polyfit degree from horizontal

在我的项目中,我有一条 best-fit 行用于一些我使用 np.polyfit 得到的点。这样,我想计算返回的 best-fit 行和 horizon 之间的度数。就好像 best-fit 行中的第一个点在原点。我的一些误解来自于混淆什么是 polyfit returns。我怎样才能最好地获得角度?

import numpy as np
# simulate some data:
x = np.arange(10, dtype=np.float)
b = 1.5
y = 2 * x + b
# fit the data with a 1st degree polynomial
# (1st degree because poster mentions "best-fit *line*"):
cf = np.polyfit(x, y, 1)
np.rad2deg(np.arctan(cf[0]))

观看 https://www.brightstorm.com/math/precalculus/advanced-trigonometry/angle-inclination-of-a-line/ 多项式系数(视频中的 cf[0​​] = m)与角度的关系可能会有用。