我是机器学习的初学者,我在pyplot的散点图方法中遇到了颜色错误,同样的错误在's = None'参数中也很普遍
def my_age_months(x):
return (x*12)
a = my_age_months(36)
print("a:")
print(a)
if a > 400:
return "you are not young"
else:
return "you are young"
我收到此错误
pyplot.scatter = (X_train, y_train, c = 'red')
pyplot.plot = (X_train, regressor.predict(X_train), c = 'blue')
如何消除此错误,以及如何将“ color ='red'“替换为” c ='red'“?
答案 0 :(得分:1)
您必须删除=
:
pyplot.scatter(X_train, y_train, c = 'red')
pyplot.plot(X_train, regressor.predict(X_train), c = 'blue')
PS。
按照惯例,matplotlib
库通常以这种方式导入:
import matplotlib.pyplot as plt
plt.scatter(X_train, y_train, c = 'red')