Stata画图——散点图与折线图
程序员文章站
2024-01-19 12:37:16
...
散点图
twoway (scatter yield time, sort msymbol(circle)) , ///
xtitle(Time) ylabel(0(.5)2.5) ytitle(Yield) ///
title(Wheat Yield)
graph save wawheat, replace
多条折线图
bys ifReturn year:egen if_DA=mean(DA) if ifReturn==1
bys ifReturn year:egen notif_DA=mean(DA) if ifReturn==0
twoway (connect if_DA year,sort symbol(D)) (connect notif_DA year,msymbol(+)), ytitle("DA") xtitle("年份")
twoway (connect company1 year ,msymbol(+)) (connect company2 year ,symbol(D)) (connect company3 year, symbol(D)), ///
title("Total Assets Scale(In Billion)") xlabel(1998(2)2018) xtick(1998(1)2018) ///
legend(ring(1) pos(5) cols(3) label(1 "company1") label(2 "company2") label(3 "company3"))
散点图与折线图
twoway (scatter yield time, sort) ///
(line yhat3 time, sort lwidth(medthick)) , ///
xtitle(Time) ytitle(Yield) ylabel(0(.5)2.5) ///
title(Wheat Yield Fitted Cubic Model)
graph save wheat_cubic_fit, replace
twoway (scatter wage educ, sort msize(small)) ///
(line yhatn educ, sort lwidth(medthick) lpattern(solid)) ///
(line ub_wage educ, sort lcolor(forest_green) lwidth(medthick) ///
lpattern(dash)) ///
(line lb_wage educ, sort lcolor(forest_green) lwidth(medthick) ///
lpattern(dash))
graph save lwage_interval, replace