Sepal Length Distribution across Iris Species

For the Iris dataset, create a box plot to show the distribution of ‘sepal length’ for each species.

Example Output:

You can use the sns.boxplot function, and the Iris dataset can be loaded using sns.load_dataset('iris').

import seaborn as sns
import matplotlib.pyplot as plt

def plot_iris_sepal_length():
    iris_data = sns.load_dataset('iris')
    sns.boxplot(x='species', y='sepal_length', data=iris_data)
    plt.title('Sepal Length Distribution across Iris Species')
    plt.show()

plot_iris_sepal_length()

 

© Let’s Data Science

LOGIN

Unlock AI & Data Science treasures. Log in!