首页 > 其他 > 详细

鸢尾花分类散点图

时间:2021-08-23 14:59:35      阅读:18      评论:0      收藏:0      [点我收藏+]
from sklearn.datasets import load_iris
import matplotlib
import matplotlib.pyplot as plt


iris= load_iris()

matplotlib.rcParams[‘font.sans-serif‘] = [‘SimHei‘]
matplotlib.rcParams[‘axes.unicode_minus‘] = False

x_index =0
y_index =1
colors =[‘red‘, ‘green‘, ‘blue‘]

for label, color in zip(range(len(iris.target_names)), colors):
    plt.scatter(iris.data[iris.target==label, x_index],
        iris.data[iris.target==label, y_index],
        # label = iris.target_names[label],
         c = color,alpha = 3/10)
       # 透明度设置

plt.xlabel(‘萼片长度‘)
plt.ylabel(‘萼片宽度‘)
plt.legend
plt.show()

鸢尾花分类散点图

原文:https://www.cnblogs.com/bear-king/p/15175177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!