An update to violinplot is available from SSC. Type
to install the update.
There are two main additions.
(1) Option rag() can now be used with suboption stack to produce so-called raindrop plots.
Examples:


(2) If weights are specified, markers in the rag are now scaled in relation to the weights (with average weight corresponding to the unweighted marker size). This also translates suboption unique, which now scales the markers in relation to the represented data mass even if no weights are specified. Use suboption noweight in rag() to suppress the new behavior.
Examples:


Same graph using fixed marker size (suboption noweight):

ben
Code:
. ssc install violinplot, replace
There are two main additions.
(1) Option rag() can now be used with suboption stack to produce so-called raindrop plots.
Examples:
Code:
sysuse auto violinplot mpg turn, left rag(stack right msymbol(o) offset(-0.05))
Code:
sysuse nlsw88 violinplot wage tenure, pdf(ll(0)) dscale(1.5) left rag(stack msymbol(p))
(2) If weights are specified, markers in the rag are now scaled in relation to the weights (with average weight corresponding to the unweighted marker size). This also translates suboption unique, which now scales the markers in relation to the represented data mass even if no weights are specified. Use suboption noweight in rag() to suppress the new behavior.
Examples:
Code:
sysuse auto violinplot mpg turn, nomed nobox nowhisk rag(uniq msymbol(o))
Code:
webuse nhanes2f violinplot loglead [pweight=finalwgt], over(sex) nobox nowhisk nomed /// pstyles(1 2) rag(spread(10) msymbol(o) mcolor(%20) mlcolor(%0))
Same graph using fixed marker size (suboption noweight):
Code:
violinplot loglead [pweight=finalwgt], over(sex) nobox nowhisk nomed /// pstyles(1 2) rag(spread(10) msymbol(o) mcolor(%20) mlcolor(%0) noweight)
ben
Comment