Violin Plots are a powerful graphing tool that allows you to compare multiple distributions at once.

Let’s look at how our original three data sets look like as violin plots:

sns.violinplot(data=df, x="label", y="value") plt.show()

As we can see, violin plots allow us to graph and compare multiple distributions. It also retains the shape of the distributions, so we can easily tell that Dataset 1 is skewed left and that Dataset 3 is bimodal.

To plot a violin plot in Seaborn, use the method sns.violinplot().

There are several options for passing in relevant data to the x and y parameters:

  • data - the dataset that we’re plotting, such as a list, DataFrame, or array
  • x, y, and hue - a one-dimensional set of data, such as a Series, list, or array
  • any of the parameters to the function sns.boxplot()



Using sns.violinplot(), plot the four datasets as violin plots.


Use plt.show() to display the violin plots.

Notice how much easier it is to compare the shape of the datasets than when they were layered on top of each other!

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?