Stata如何绘制散点信息图?

下载字体Silhous Font,信息如下:
浏览地址https://www.fontspace.com/silhous-font-f3542
下载地址https://www.fontspace.com/get/family/63qp
安装字体Silhous Font,方法如下:
压缩包解压后,将MixedBag2-R013.ttf复制到 Windows系统的字体目录下(C:\Windows\Fonts)即可。

绘制上图的Stata代码如下:


sysuse nlsw88, clear
egen swage = mean(wage) if never_married == 1
egen mwage = mean(wage) if married == 1
egen dwage = mean(wage) if never_married == 0 & married == 0
label variable swage "Wage ($ per hour)"
label variable mwage "Wage ($ per hour)"
label variable dwage "Wage ($ per hour)"
egen sage = mean(age) if never_married == 1
egen mage = mean(age) if married == 1
egen dage = mean(age) if never_married == 0 & married == 0
label variable sage "Age (Average)"
label variable mage "Age (Average)"
label variable dage "Age (Average)"

generate marsindiv = 1
replace marsindiv = 0 if never_married == 0 & married == 0
replace marsindiv = 2 if never_married == 1
label define marsinlbl 0 `"{fontface "Silhous":-.}"' 1 `"{fontface "Silhous":T}"' 2 `"{fontface "Silhous":E}"'
label values marsindiv marsinlbl

twoway (scatter swage sage, mlabsize(*20) mlabcolor(red) mlabel(marsindiv) msymbol(i) legend(off) ylabel(7(.4)9, nogrid) xlabel(38(.5)40)) ///
(scatter mwage mage, mlabsize(*5) mlabcolor(purple) mlabel(marsindiv) msymbol(i)) ///
(scatter dwage dage, mlabsize(*10) mlabcolor(blue) mlabel(marsindiv) msymbol(i))

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