Finish TP1 exo1
[TP_AA.git] / TP1 / exo1 / TP1prog1.py
index f0e5324713a1b6409b1e6bc6c9b36fa790a96465..9953cf7cfcd18eab97f34d2aa3f8734db0c978f2 100755 (executable)
@@ -9,17 +9,70 @@ irisData = load_iris()
 X = irisData.data
 Y = irisData.target
 
+colors = ["red", "green", "blue"]
+
 x = 0
 y = 1
+for i in range(3):
+    pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
+               label=irisData.target_names[i])
+pl.legend()
+pl.xlabel(irisData.feature_names[x])
+pl.ylabel(irisData.feature_names[y])
+pl.title(u"Données Iris - dimension des sépales uniquement")
+pl.show()
 
-colors = ["red", "green", "blue"]
+x = 2
+y = 3
+for i in range(3):
+    pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
+               label=irisData.target_names[i])
+pl.legend()
+pl.xlabel(irisData.feature_names[x])
+pl.ylabel(irisData.feature_names[y])
+pl.title(u"Données Iris - dimension des pétales uniquement")
+pl.show()
+
+x = 0
+y = 3
+for i in range(3):
+    pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
+               label=irisData.target_names[i])
+pl.legend()
+pl.xlabel(irisData.feature_names[x])
+pl.ylabel(irisData.feature_names[y])
+pl.title(u"Données Iris - dimension des sépales et pétales")
+pl.show()
+
+x = 1
+y = 2
+for i in range(3):
+    pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
+               label=irisData.target_names[i])
+pl.legend()
+pl.xlabel(irisData.feature_names[x])
+pl.ylabel(irisData.feature_names[y])
+pl.title(u"Données Iris - dimension des sépales et pétales")
+pl.show()
 
+x = 0
+y = 2
 for i in range(3):
     pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
                label=irisData.target_names[i])
+pl.legend()
+pl.xlabel(irisData.feature_names[x])
+pl.ylabel(irisData.feature_names[y])
+pl.title(u"Données Iris - dimension des sépales et pétales")
+pl.show()
 
+x = 1
+y = 3
+for i in range(3):
+    pl.scatter(X[Y == i][:, x], X[Y == i][:, y], color=colors[i],
+               label=irisData.target_names[i])
 pl.legend()
 pl.xlabel(irisData.feature_names[x])
 pl.ylabel(irisData.feature_names[y])
-pl.title(u"Données Iris - dimension des sépales uniquement")
+pl.title(u"Données Iris - dimension des sépales et pétales")
 pl.show()