I have a command to graph a box plot for multiple variables and year as follow
Code:
graph box eei_m* if (sec_gr=="23941" | sec_gr=="201" | sec_gr=="241" | sec_gr=="2392" | sec_gr=="170" /// | sec_gr=="131" | sec_gr=="263" | sec_gr=="141") & year<2016, over(year, label(angle(90) labsize(small))) /// over(sec_gr, label(nolabels) sort(eei_m23941 eei_m201 eei_m241 eei_m2392 eei_m170 eei_m131 eei_m263 eei_m141)) /// graphregion(fcolor(gs16)) legend(cols(4) symxsize(11) size(small)) nofill nolabel
The problem is, the order of box plots are not same as the order of legend names, which is in right order. As you can see, I have used option - sort - to force boxes into right order but it does not work.
Could you please help me to revise the code to put them into order of the legends? (I can change the order of legends following order of the boxes, but that's not what I want)
Array
0 Response to Need to change order of boxes in box plot command
Post a Comment