ComenzarEmpieza gratis

Box-and-whisker plot

Making a box plot for the petal lengths is unnecessary because the iris data set is not too large and the bee swarm plot works fine. However, it is always good to get some practice. Make a box plot of the iris petal lengths. You have a pandas DataFrame, df, which contains the petal length data, in your namespace. Inspect the data frame df using df.head() to make sure you know what the pertinent columns are.

For your reference, the code used to produce the box plot in the video is provided below:

_ = sns.boxplot(x='east_west', y='dem_share', data=df_all_states)
_ = plt.xlabel('region')
_ = plt.ylabel('percent of vote for Obama')

You can use sns.boxplot? or help(sns.boxplot) for more details on how to make box plots using seaborn.

Este ejercicio forma parte del curso

Statistical Thinking in Python (Part 1)

Ver curso

Instrucciones del ejercicio

  • The set-up is exactly the same as for the bee swarm plot; you just call sns.boxplot() with the same keyword arguments as you would sns.swarmplot(). The x-axis is 'species' and y-axis is 'petal length (cm)'.
  • Don't forget to label your axes!
  • Display the figure using the normal call.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Create box plot with Seaborn's default settings


# Label the axes



# Show the plot

Editar y ejecutar código