Dear all,

I would like to use coefplot to compare the coefficients from different models and categorical variables. I am using different data, but I recreated a (nonsensical) example that shows my question using the auto-dataset:

Code:
webuse auto, clear
gen dummy_weight = 0 // I define a categorical variable for the weight of a car
replace dummy_weight = 1 if weight > 2000 & weight <= 3000
replace dummy_weight = 2 if weight > 3000
eststo est_1: reg headroom i.dummy_weight if foreign == 0 // I estimate a model separate for domestic and foreign car makers
eststo est_2: reg headroom i.dummy_weight if foreign == 1 
coefplot est_*, keep(1.dummy_weight 2.dummy_weight) swapnames asequation // I compare the coefficents
My issue with the graph is that there are two groups (1.dummy_weight and 2.dummy_weight) and for each of them est_1 and est_2 are presented separately. Is there a way to have only est_1 and est_2 once on the y-axis, and then compare 1.dummy_weight and 2_dummy_weight next to it? So that there is not est_1 and est_2 in the legend at the bottom, but 1.dummy_weight and 2.dummy_weight (in blue and red)?

I am attaching a screenshot from the output and what I would like to have.

Thank you very much for your help!

All the best
Leon

Array