This answer shows how to modify Matplotlib's violinplots.
Those violinplots can also be adapted to only show the upper half of a violin plot.
pos = np.arange(1, 6) / 2.0
data = [np.random.normal(0, std, size=1000) for std in pos]
violins = plt.violinplot(data, positions=pos, showextrema=False, vert=False)
for body in violins['bodies']:
paths = body.get_paths()[0]
mean = np.mean(paths.vertices[:, 1])
paths.vertices[:, 1][paths.vertices[:, 1] <= mean] = mean
A nice looking overlapping variant can be easily created by setting the bodies' transparency to 0, adding an edgecolor and making sure to plot underlying KDEs first:
pos = np.arange(1, 6) / 2
data = [np.random.normal(0, std, size=1000) for std in pos]
violins = plt.violinplot(
data[::-1],
positions=pos[::-1]/5,
showextrema=False,
vert=False,
)
for body in violins['bodies']:
paths = body.get_paths()[0]
mean = np.mean(paths.vertices[:, 1])
paths.vertices[:, 1][paths.vertices[:, 1] <= mean] = mean
body.set_edgecolor('black')
body.set_alpha(1)
