我正在使用下面的代码来可视化我的算法。但我遇到以下错误的问题。
AttributeError:属性颜色未知
from matplotlib import pyplot as plt
regression = LinearRegression()
model = regression.fit(X_train,Y_train)
preds = model.predict(X_test)
plt.scatter(X_train,Y_train, colour = 'red')
plt.plot(X_train, preds, colour = 'blue')
plt.title('salary vs experiance')
plt.xlabel("years")
plt.ylabel("salary")
plt.show()
你应该给它color
而不是colour
plt.scatter(X_train,Y_train, color = 'red')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句