Bee swarm plot
Make a bee swarm plot of the iris petal lengths. Your x-axis should contain each of the three species, and the y-axis the petal lengths. A data frame containing the data is in your namespace as df.
For your reference, the code Justin used to create the bee swarm plot in the video is provided below:
_ = sns.swarmplot(x='state', y='dem_share', data=df_swing)
_ = plt.xlabel('state')
_ = plt.ylabel('percent of vote for Obama')
plt.show()
You can use help(sns.swarmplot) for more details on how to make bee swarm plots using seaborn.
Deze oefening maakt deel uit van de cursus
Statistical Thinking in Python (Part 1)
Oefeninstructies
- Inspect the DataFrame
dfusingdf.head(). This will let you identify which column names you need to pass as thexandykeyword arguments in your call tosns.swarmplot(). - Use
sns.swarmplot()to make a bee swarm plot from the DataFrame containing the Fisher iris data set,df. The x-axis should contain each of the three species, and the y-axis should contain the petal lengths. - Label the axes.
- Show your plot.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Create bee swarm plot with Seaborn's default settings
# Label the axes
# Show the plot