# Make a boxplot of each petal and sepal measurementimport matplotlib.pyplot as pltdata.boxplot(column=["petal_width", "petal_length", "sepal_width", "sepal_length"],by="species", rot=90)plt.show()data.boxplot(by='species');plt.show()# Create a single boxplot where the features are separated in the x-axis and species are colored with different hues# First we have to reshape the data so there is only a single measurement in each columnplot_data = (data .set_index('species') .stack() .to_frame() .reset_index() .rename(columns={0:'size', 'level_1':'measurement'}) )print(plot_data.head())species measurement size
0 setosa sepal_length 5.1
1 setosa sepal_width 3.5
2 setosa petal_length 1.4
3 setosa petal_width 0.2
4 setosa sepal_length 4.9
# Plot the dataframe from above using Seabornimport seaborn as snsimport matplotlib.pyplot as pltsns.set_style('white')sns.set_context('notebook')sns.set_palette('dark')f = plt.figure(figsize=(6,4))sns.boxplot(x='measurement', y='size', hue='species', data=plot_data);plt.show()# Create a pairplot with Seaborn to examine the correlation between each of the measurementsimport seaborn as snsimport matplotlib.pyplot as pltsns.set_context('talk')sns.pairplot(data, hue='species');plt.show()