上图的Stata代码如下:
* Figures: bar plot of two variables
global graph_opts1 bgcolor(white) graphregion(color(white)) ///
legend(region(lc(none) fc(none))) ylabel(,angle(0) nogrid) ///
title(, justification(left) color(black) span pos(11)) ///
subtitle(, justification(left) color(black))
use "http://ds.epiman.cn/uploads/2022/06/bar-over.dta" , clear
graph bar treat_correct, over(type) asy bargap(20) ///
over(study) over(case) nofill ///
blabel(bar, format(%9.2f)) ${graph_opts1} ///
bar(1 , lc(black) lw(thin) fi(100)) ///
bar(2 , lc(black) lw(thin) fi(100)) ///
legend(r(1) order(0 "Measurement:" 1 "Standardized Patient" ///
2 "Clinical Vignette")) ///
ytitle("Providers ordering correct treatment {&rarr}", ///
placement(bottom) justification(left)) ///
ylabel(${pct})
* Have a lovely day!
* Source:https://worldbank.github.io/stata-visual-library/bar-over.html