Here is the explanation of the code:
- As we did earlier, first read the data using pandas, and create another new species1 attribute in the same Iris dataset to hold the numeric class of 0, 1, and 2 for the respective text classes as given in the map function.
- ax[0].scatter() plots a scatter plot of petal_length and petal_width, since there are three classes the data points form three clusters as shown in different colors.
- bbox_props = dict(boxstyle="round", fc="w", ec="0.25", alpha=0.9) defines the text box with:
- boxstyle as rounded edges
- face color as white
- edge color as light gray
- lower transparency
- ax[0].text() plots the text box, one for each cluster. It is similar to plotting text as we learned earlier, except that ...