I'm trying to customize my plots, and I would like to include the marker for each group in the legend, however, I've been unable to do so.
The default plot retains the symbol in the legend; I would like to do the same.
The default plot retains the symbol in the legend; I would like to do the same.
Code:
use http://www.stata-press.com/data/r13/systolic.dta, clear
anova systolic i.drug i.disease i.drug#i.disease
estat esize
margins i.drug#i.disease , at( (asbalanced) _factor)
marginsplot , name(margins_default, replace) title(" ") ///
marginsplot , name(margins_custom, replace) title(" ") ///
legend(order( 1 "ds1" 2 "ds2" 3 "ds3" ) position(6) ring(75) ) ///
plot1opts( msymbol(Oh) mcolor("0 75 135") mlwidth(*.85) lcolor("0 75 135") lwidth(*.85) ) ///
ci1opts(lcolor("0 75 135") lwidth(*.85) ) ///
plot2opts(msymbol(O) mcolor("150 150 150") mlwidth(*.85) lcolor("150 150 150") lwidth(*.85) ) ///
plot3opts(msymbol(X) mcolor("200 200 200") mlwidth(*.85) lcolor("200 200 200") lwidth(*.85) ) ///
ytitle("Model Based Mean", margin(0 3 0 0)) ///
xtitle("Drugs Used", margin(3 0 3 3) ) xlabel(1 "A" 2 "B" 3 "C" 4 "D")
graph display margins_test , ysize(5) xsize(7) margins(l=10 r=20 b=5)

Comment