Hey stata experts,
I am having trouble identifying the problems with my code when doing a bar graph using six legend items. Specifically, I have seven racial groups on x axis and each group is supposed to have six disability types which need to be graphed out. In my codes, I included six bars to represent the six disability types. When I hit do, stata doesn't spit out any errors but the graph's legend looks wrong: three out of six disability types are correctly shown with colors but colors of the rest of the three legend items are missing. I don't know what's wrong with my code. Is this because the graph area is too small to graph all six out? Any suggestions please?
Below are my codes:
graph bar SLD SLI AUT, bargap(-30) bar(1, fcolor(dknavy) lcolor(dknavy)) ///
bar(2, fcolor(dknavy*.7) lcolor(dknavy*.7)) bar(3, fcolor(maroon) lcolor(maroon)) ///
bar(4, fcolor(maroon*.7) lcolor(maroon*.7)) bar(5,fcolor(dkorange) lcolor(dkorange)) ///
bar(6, fcolor(dkorange*.7) lcolor(dkorange*.7)) ///
blabel(bar, position(inside) color(white) format(%10.0f))over(race, ///
relabel(1 "AsianIndian" 2 "Chinese" 3 "Filipino" 4 "Hmong" 5 "Japanese" 6 "Korean" 7 "OA") ///
label(labsize(medsmall))) title("Distribution of Disability Types", span)subtitle("by Race", span) ///
ytitle("Percent", size(medsmall))ylabel(0(20)100, labsize(medsmall) nogrid) ///
ylabel (0(1.5)8,labsize(medsmall) nogrid) ///
legend(order(1 "AUT" 2 "SLD" 3 "SLI" 4 "EBD" 5 "MUL" 6 "ID") ring(0) position(11) symxsize(2) symysize(2) rows(2) ///
size(medsmall) region(lstyle(none) lcolor(none) color(none))) ///
graphregion(color(white) fcolor(white) lcolor(white))plotregion(color(white) ///
fcolor(white) lcolor(white) margin(zero))
I am having trouble identifying the problems with my code when doing a bar graph using six legend items. Specifically, I have seven racial groups on x axis and each group is supposed to have six disability types which need to be graphed out. In my codes, I included six bars to represent the six disability types. When I hit do, stata doesn't spit out any errors but the graph's legend looks wrong: three out of six disability types are correctly shown with colors but colors of the rest of the three legend items are missing. I don't know what's wrong with my code. Is this because the graph area is too small to graph all six out? Any suggestions please?
Below are my codes:
graph bar SLD SLI AUT, bargap(-30) bar(1, fcolor(dknavy) lcolor(dknavy)) ///
bar(2, fcolor(dknavy*.7) lcolor(dknavy*.7)) bar(3, fcolor(maroon) lcolor(maroon)) ///
bar(4, fcolor(maroon*.7) lcolor(maroon*.7)) bar(5,fcolor(dkorange) lcolor(dkorange)) ///
bar(6, fcolor(dkorange*.7) lcolor(dkorange*.7)) ///
blabel(bar, position(inside) color(white) format(%10.0f))over(race, ///
relabel(1 "AsianIndian" 2 "Chinese" 3 "Filipino" 4 "Hmong" 5 "Japanese" 6 "Korean" 7 "OA") ///
label(labsize(medsmall))) title("Distribution of Disability Types", span)subtitle("by Race", span) ///
ytitle("Percent", size(medsmall))ylabel(0(20)100, labsize(medsmall) nogrid) ///
ylabel (0(1.5)8,labsize(medsmall) nogrid) ///
legend(order(1 "AUT" 2 "SLD" 3 "SLI" 4 "EBD" 5 "MUL" 6 "ID") ring(0) position(11) symxsize(2) symysize(2) rows(2) ///
size(medsmall) region(lstyle(none) lcolor(none) color(none))) ///
graphregion(color(white) fcolor(white) lcolor(white))plotregion(color(white) ///
fcolor(white) lcolor(white) margin(zero))
Comment