| 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | # -*- coding: utf-8 -*- |
| 4 | import pylab as pl |
| 5 | |
| 6 | from sklearn.datasets import load_iris |
| 7 | irisData = load_iris() |
| 8 | |
| 9 | X = irisData.data |
| 10 | Y = irisData.target |
| 11 | |
| 12 | x = 0 |
| 13 | y = 1 |
| 14 | |
| 15 | colors = ["red", "green", "blue"] |
| 16 | |
| 17 | for i in range(3): |
| 18 | pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i], |
| 19 | label=irisData.target_names[i]) |
| 20 | |
| 21 | pl.legend() |
| 22 | pl.xlabel(irisData.feature_names[x]) |
| 23 | pl.ylabel(irisData.feature_names[y]) |
| 24 | pl.title(u"Données Iris - dimension des sépales uniquement") |
| 25 | pl.show() |