Dear STATA community,
I am producing figures using the "graph bar" command. Some of my bars are greyscale but some are white. I would like to have the bar label appear in white for the greyscale bars and black for the white bars. Can someone please let me know how to do this? As of now I can only see one way to edit the color of the bar labels (the "blabel" command) and this makes all bar labels one color.
For reference my code is:
#delimit ;
gr bar nationality_clgr_prcnt, over(nationality_cl) over(round)
asyvars stack blabel(bar, format(%2.0f) size(3) pos(center) color(gs12))
bargap(0) plotregion(style(none)) graphregion(margin(4 3 3 5 ))
bar(1, fcolor(gs1) lcolor(gs1) lwidth(.2))
bar(2, fcolor(gs9) lcolor(gs1) lwidth(.2))
bar(3, fcolor(gs4) lcolor(gs1) lwidth(.2))
bar(4, fcolor(gs7) lcolor(gs1) lwidth(.2))
bar(5, fcolor(white) lcolor(gs1) lwidth(.2))
ylabel(0 (20) 100,labs(4) nogrid) ytitle("Percentage", size(4)) ysize(13) xsize(20)
legend( pos(right) rows(5) size(3) order(5 4 3 2 1));
Thank you!
I am producing figures using the "graph bar" command. Some of my bars are greyscale but some are white. I would like to have the bar label appear in white for the greyscale bars and black for the white bars. Can someone please let me know how to do this? As of now I can only see one way to edit the color of the bar labels (the "blabel" command) and this makes all bar labels one color.
For reference my code is:
#delimit ;
gr bar nationality_clgr_prcnt, over(nationality_cl) over(round)
asyvars stack blabel(bar, format(%2.0f) size(3) pos(center) color(gs12))
bargap(0) plotregion(style(none)) graphregion(margin(4 3 3 5 ))
bar(1, fcolor(gs1) lcolor(gs1) lwidth(.2))
bar(2, fcolor(gs9) lcolor(gs1) lwidth(.2))
bar(3, fcolor(gs4) lcolor(gs1) lwidth(.2))
bar(4, fcolor(gs7) lcolor(gs1) lwidth(.2))
bar(5, fcolor(white) lcolor(gs1) lwidth(.2))
ylabel(0 (20) 100,labs(4) nogrid) ytitle("Percentage", size(4)) ysize(13) xsize(20)
legend( pos(right) rows(5) size(3) order(5 4 3 2 1));
Thank you!
Comment