Here is reproducible example of my problem, below. The first graph works fine, but imagine that I wanted to change the SECOND marker to a square rather than a circle. I can't figure out how to do it; neither of the two attempts at the bottom are successful.
I'm open to code that gets at the same figure without margins(plot). I tried unsuccessful hacks with both combomarginsplot and coefplot.
Code:
sysuse auto.dta, clear
gen heavy=weight>3500
gen cat = substr(make, 1, strpos(make, " ") - 1)
bysort cat: gen x=_n
bysort cat: egen y=max(x)
drop if x==y
encode(cat), gen(emake)
drop if emake==.
reg heavy i.emake
margins emake
* this works fine, but let's say I want the SECOND market to be a square
marginsplot, recast(scatter) ///
plotopts(msymbol(O))
* this doesn't work; it's for various margins not various values
marginsplot, recast(scatter) ///
plotopts(msymbol(O)) plot2opts(msymbol(S))
* this felt like it might work, but it doesn't
marginsplot, recast(scatter) ///
plotopts(msymbol(O S O O O O O O O O O O O O O O O O O O))
0 Response to Marginsplot: Changing markers by categorical value along x-axis
Post a Comment