💮 The Great Iris Festival¶
Scenario
In the enchanted land of Seabornea, flowers were not just pretty sights to admire but were sentient beings with aspirations, desires, and a knack for a little friendly competition. Every year, they organized the Great Iris Festival, where different Iris flowers showcased their unique talents.
This year, the festival was abuzz with excitement. The three legendary species of the Iris clan - Setosa, Versicolor, and Virginica - were to participate in a series of contests that would finally decide which species was the most illustrious of them all!
Exercise
Explore the Iris dataset and learn about the distributions and relationships of its features using Seaborn to help the judges decide which species is the most talented of them all!
import seaborn as sns
import matplotlib.pyplot as plt
iris_df = sns.load_dataset('iris')
Task 1: Distribution of Sepal Length
- Create a histogram of the
sepal_length
column usingsns.histplot
. - Color the histogram using the
species
column. - Customize the appearance (color, bin size, etc.).
Task 2: Compare Sepal Width and Length
- Use
sns.scatterplot
to comparesepal_width
andsepal_length
. - Color the points based on the species.
- Add a title and labels for clarity.
Task 3: Pairwise Relationships
- Use
sns.pairplot
to visualize pairwise relationships between all numerical columns. - Color the points based on species.
- Do you observe any clusters? Which features separate the species the best?
/home/vscode/.pyenv/versions/3.9.17/lib/python3.9/site-packages/seaborn/axisgrid.py:118: UserWarning: The figure layout has changed to tight self._figure.tight_layout(*args, **kwargs)
Task 4: Boxplots for Comparing Features
- Use
sns.boxplot
to showcase the distribution ofpetal_length
across different species. - Observe which species has the widest range of
petal_length
and which one has the smallest.
Task 5: Violin Plot Exploration
- Create a
sns.violinplot
comparing the distribution ofpetal_width
across different species. - Contrast this with the box plot. What additional information can you derive from the violin plot?
๐ By the end of the festival, the entire land of Seabornea was in joyous spirits. It was not about deciding which species was the best, but celebrating the unique qualities each one brought to the table. And as the sun set on Seabornea, the Irises, having put on a grand show, went back to their meadows, eagerly awaiting next year's festival.๐