October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following code block plots Iris data twice on two different axes. One uses regular legend to indicate three different clusters with different colors and labels. The other uses a textbox within the cluster of points to indicate the class:
fig, ax = plt.subplots(1,2, figsize=(10,6))
iris = pd.read_csv('iris_dataset.csv', delimiter=',')iris['species1'] = iris['species'].map({"setosa" : 0, "versicolor" : 1, "virginica" : 2})
ax[0].scatter(iris.petal_length, iris.petal_width, s=10*iris.petal_length*iris.petal_width, c=iris.species1)
Read now
Unlock full access