import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv('https://www.dropbox.com/s/mqyxvm8z2v1a20g/iris.data?dl=1',header=None) X = df.iloc[0:100, [0, 2]].values #extract values # print(X) plt.scatter(X[:50, 0], X[:50, 1], color='red', marker='o', label='setosa') plt.scatter(X[50:100, 0], X[50:100, 1], color='blue', marker='x', label='versicolor') plt.xlabel('sepal length [cm]') plt.ylabel('petal length [cm]') plt.legend(loc='upper left') plt.show()
这画的是花萼长度和花瓣长度
COMP7404 Machine Learing——绘制数据点
最新推荐文章于 2024-11-07 22:09:22 发布