matplotlib之散点图分类展示图例

action = film.loc[film["类别"] == "动作"]
love = film.loc[film["类别"] == "爱情"]

plt.scatter(action["动作镜头"], action["爱情镜头"], s=180, color=colors[2], label="ACTION")
plt.scatter(love["动作镜头"], love["爱情镜头"], s=180, color=colors[5], label="LOVE")

plt.scatter(X_test[:,0], X_test[:,1],s=200, color="k", label="predicting")
plt.xlabel("action")
plt.ylabel("love")
plt.legend()
发布了530 篇原创文章 · 获赞 17 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44038167/article/details/104267374