In this recipe, we will learn how to embed a text box to identify different clusters in the plot. We will use a familiar Iris dataset that has three clusters of data.
Using a text box
Getting ready
Import the required libraries:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
How to do it...
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:
- Define the figure...