'vioplot areaEqual does not seem to make areas equal

I'm using R package vioplot and find something puzzling about areaEqual.

By default, this argument is off, and violins are made such that the maximal widths are equal:

vioplot::vioplot(mpg ~ cyl, data = mtcars, areaEqual = FALSE)

With areaEqual enabled, violins are said to "have equal density area" (https://cran.r-project.org/web/packages/vioplot/vignettes/violin_area.html):

vioplot::vioplot(mpg ~ cyl, data = mtcars, areaEqual = TRUE, add = TRUE, col = "red")

From the second plot (red overlay), however, it's obvious that the areas are not equal: the middle group is the smallest while the left group is the largest.

vioplot

If areaEqual = TRUE indeed makes the areas equal, it should look like the second plot (Equal Areas) in https://stats.stackexchange.com/questions/13555/how-to-scale-violin-plots-for-comparisons:

expected

Does anybody know why? Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source