I am having trouble controlling coefplot labels and markers simultaneously. I'm using coefplot to display a series of means and their CIs, each created in a different city-specific dataset. So I'm looping through the datasets and saving the mean estimate for display.
Here are 2 examples of the problem.
I can't figure out how to maintain the marker when I add the label. In an ideal world, I'd like to actually add the label INSIDE the loop as the value of iteration-specific `city'... in another version of the code I did that, but using mat and erepost, and I couldn't figure out how to store the CIs with that method. Help on making this code effective and efficient would be appreciated!
Here are 2 examples of the problem.
Code:
local agrp `"Chandler Columbus Hartford "Los Angelos" Mesa Montgomery "New Orleans" Portland Tucson"'
local bgrp `"ChandlerCallsCoded_Fix_C4SO ColumbusCallsCoded_Fix_C4SO HartfordCallsCoded_Fix_C4SO LACallsCoded_Fix_C4SO MesaCallsCoded_Fix_C4SO MontgomeryCallsCoded_Fix_C4SO NewOrleansCallsCoded_Fix_C4SO PortlandCallsCoded_Fix_C4SO TucsonCallsCoded_Fix_C4SO"'
local n : word count `agrp'
clear matrix
forvalues i = 1/`n' {
local city : word `i' of `agrp'
local dname : word `i' of `bgrp'
use "${DSAVE}/`dname'", clear
qui mean XVAR
estimate store m`i'
}
** This one creates labels, but won't display the 3rd markers as a square.
coefplot m1, bylabel(Chandler) ///
|| m2, bylabel(Columbus) ///
|| m3, bylabel(Hartford) ///
|| , bycoefs byopts(xrescale) vert ///
mcolor(navy) ciopts(color(navy)) ///
p3(msymbol(S)) ///
xlabel(, angle(45)) ytitle("Percent of Dispatches") ///
graphregion(color(white)) msize(small) ///
legend(order(2 "Calls for service" ///
6 "A subset of calls for service") rows(2))
** This one displays the 3rd markers as a square but has no label
coefplot m*, vert mcolor(navy) ciopts(color(navy)) ///
p3(msymbol(S)) ///
xlabel(, angle(45)) ytitle("Percent of Dispatches") ///
graphregion(color(white)) msize(small) ///
legend(order(2 "Calls for service" ///
6 "A subset of calls for service") rows(2))

Comment