Dear Statalist,
There was once a Stata Journal article (http://www.stata-journal.com/article...article=gr0026) that showed how to slightly offset markers in figures, namely like this:

Is there an easy solution to do the same for marginsplot, in a situation like this for example?

Thank you in advance
Go
There was once a Stata Journal article (http://www.stata-journal.com/article...article=gr0026) that showed how to slightly offset markers in figures, namely like this:
Code:
clear
input visit str10 group dep sddep n high low
1 Placebo 16.48 5.28 27 18.51 14.45
1 Estrogen 13.37 5.56 34 15.28 11.46
2 Placebo 15.89 6.12 22 18.50 13.28
2 Estrogen 11.74 6.58 31 14.10 9.38
3 Placebo 14.13 4.97 17 16.54 11.72
3 Estrogen 9.13 5.48 29 11.17 7.09
4 Placebo 12.27 5.85 17 15.11 9.43
4 Estrogen 8.83 4.67 28 10.60 7.06
5 Placebo 11.40 4.44 17 13.55 9.25
5 Estrogen 7.31 5.74 28 9.48 5.14
end
clonevar x = visit
replace x = cond(group == "Placebo", x - 0.05, x + 0.05)
twoway (connected dep x if group == "Placebo", lpattern(solid) msymbol(D)) ///
(connected dep x if group == "Estrogen", lpattern(dash) msymbol(S)) ///
(rcap high low x if group == "Placebo") ///
(rcap high low x if group == "Estrogen") ///
, xlabel(1 2 3 4 5) ylab(5(5)20, format(%5.0f)) ///
xtitle("Visit") ytitle("Depression score") ///
legend(pos(1) ring(0) col(1) order(1 "Placebo" 2 "Estrogen"))
Code:
clear webuse nhanes2 regress bpsystol agegrp##sex margins agegrp#sex marginsplot
Go

Comment