このプログラムの実行中に「スキャッターワードが定義されていません」というエラーが発生します
fig, ax= plt.subplots()
ax.scatter(x=data['Odometer (KM)'],
y=data['Price'],
c=data['Doors'])
ax.set(title='Car sales',
xlabel='Odometer',
ylabel='Price')
#legend function
ax.legend(*scatter.legend_elements(), title='Doors');
問題は、インスタンススキャッターを定義しなかったことです。これを試してみませんか?
'`` `
fig, ax= plt.subplots()
scatter = ax.scatter(x=data['Odometer (KM)'], y=data['Price'], c=data['Doors'])
ax.set(title='Car sales', xlabel='Odometer', ylabel='Price')
#legend function
ax.legend(*scatter.legend_elements(), title='Doors');
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加