How do we read a violin plot?

Question

In the context of this exercise, how do we read a violin plot to determine its distribution type?

Answer

When reading a violin plot, the distributions are essentially just rotated vertically rather than horizontally, and then mirrored on the left and right sides.

To read the distributions from a violin plot, we just need to reverse these steps. We can rotate the plots so that the values are on the x axis, and in increasing order from left to right. Then, you can ignore the mirrored side below the x axis, and read the distribution shape as you normally would, for the top half.

Keeping this in mind, we can determine the shapes of the example violin plots in the exercise:

Dataset 1 (Blue) is unimodal and has most of its data on the right, so it must be skewed left.

Dataset 2 (Green) is unimodal and seems to be symmetric and normal.

Dataset 3 (Red) appears to be bimodal.

3 Likes

Is it that you can tell from a graph that it’s bimodal because of the 2 curves that appear?

Hi, yes you are correct, it is because of the two curves that you can tell its bimodal.

Taken from a very helpful article here.

Cheers! :slight_smile:

1 Like

What value do we put in hue when that is involved in the code? It said in the instructions it takes data, x, y and hue. For me it feels like the x behaves like hue would in a barplot. So what happens if we have another list/variable/value as hue?

You could use a dataframe’s column as the value for hue (the hue takes a string value equal to column name) .

Explanation