Stata如何绘制小提琴图2?

瑞士伯尔尼大学(University of Bern)的Ben Jann开发了一款新的生成小提琴图的Stata社区命令violinplot,更为强大和灵活。

安装:

//安装violinplot
ssc install violinplot, replace
//安装依赖包
ssc install dstat, replace
ssc install moremata, replace
ssc install palettes, replace
ssc install colrspace, replace

演示例子:


sysuse nlsw88
violinplot wage ttl_exp tenure
violinplot wage ttl_exp tenure, nobox
violinplot wage ttl_exp tenure, mean
violinplot wage ttl_exp tenure, nobox mean(msymbol(X) msize(large) mcolor(maroon))
violinplot wage ttl_exp tenure, box(recast(rbar) fintensity(50) barwidth(.15)) median(msymbol(d))
violinplot wage ttl_exp tenure, vertical
violinplot wage ttl_exp tenure, pstyles(1/3)
violinplot wage ttl_exp tenure, range(. 31) plotregion(margin(r=0))
violinplot wage ttl_exp tenure, fill
violinplot wage ttl_exp tenure, noline
violinplot wage ttl_exp tenure, fill(select(3))

完,本文内容交流请移步: