Python pyplot.scatter(c=';红色';)。无效语法?
我是一个机器学习的初学者,我在pyplot的散布方法中得到了颜色的错误,同样的错误也适用于's=None'参数Python pyplot.scatter(c=';红色';)。无效语法?,python,matplotlib,machine-learning,data-science,scatter,Python,Matplotlib,Machine Learning,Data Science,Scatter,我是一个机器学习的初学者,我在pyplot的散布方法中得到了颜色的错误,同样的错误也适用于's=None'参数 pyplot.scatter = (X_train, y_train, c = 'red') pyplot.plot = (X_train, regressor.predict(X_train), c = 'blue') 我得到这个错误 plt.scatter = (X_train, y_train, c = 'red')
pyplot.scatter = (X_train, y_train, c = 'red')
pyplot.plot = (X_train, regressor.predict(X_train), c = 'blue')
我得到这个错误
plt.scatter = (X_train, y_train, c = 'red')
^
SyntaxError: invalid syntax
如何消除此错误以及当“color='red'”替换为“c='red'”时?您必须删除
=
:
pyplot.scatter(X_train, y_train, c = 'red')
pyplot.plot(X_train, regressor.predict(X_train), c = 'blue')
附言。
按照惯例,matplotlib
库通常以以下方式导入:
import matplotlib.pyplot as plt
plt.scatter(X_train, y_train, c = 'red')
您必须删除
=
:
pyplot.scatter(X_train, y_train, c = 'red')
pyplot.plot(X_train, regressor.predict(X_train), c = 'blue')
附言。
按照惯例,matplotlib
库通常以以下方式导入:
import matplotlib.pyplot as plt
plt.scatter(X_train, y_train, c = 'red')