Why are these violin plots "clipped"?

Violin plots are always clipped (I think to the range of the input data, or maybe plus some margin?), because the function that defines the curve is the sum of Gaussian distributions, which have full support.

The clipping is more obvious for data like yours that is not well approximated by a normal distribution.

Python does the same thing:

import matplotlib.pyplot as plt
plt.violinplot([[3, 3, 3, 3, 7, 7, 7, 7], [2, 2, 4, 4]])

violin

As your script doesn’t include the import statements, I can’t tell which plotting library you are using, but check the documentation for the violin! function to see if there is a scale parameter that will let you reduce the standard deviation of the Gaussians. That will create a less visible clipped appearance.

1 Like