Run in Python3


In [1]:
#import matplotlib
import matplotlib.pyplot as plt
from sklearn import datasets

%matplotlib inline

iris = datasets.load_iris()
X = iris.data
y = iris.target


fig = plt.figure()

markers = []
for i in y:
    if i == 0:
        markers.append('r')
    elif i == 1:
        markers.append('g')
    else:
        markers.append('b')

plt.scatter(X[:, 0], X[:, 1],c=markers)
plt.show()

#fig.savefig('graph.png')



In [ ]: