Hi,
I am trying to generate a bar graph in which the 15th bar is black and all the other bars grey. Unfortunately, all the bars are grey with the code below.

I know that I could achieve what I want with asyvars. Unfortunately, asyvars makes all the labels into a legend, which does not work for me.
Do you know how to either change the color of a single bar without asyvars, or use asyvars keeping the labels instead of a legend?
Thank you!
I am trying to generate a bar graph in which the 15th bar is black and all the other bars grey. Unfortunately, all the bars are grey with the code below.
Code:
graph hbar (mean) yvar if xvar != 15 & xvar != 16 [aw=phrf], title("TITLE") /// over(xvar, gap(50) relabel(1 "label1" 2 "label2" 3 "label3" 4 "label4" 5 "label5" 6 "label6" 7 "label7" 8 "label8" 9 "label9" 10 "label10" 11 "label11" 12 "label12" 13 "label13" 14 "label14" 15 "label15") label(labsize(vsmall)) sort(1) descending) /// ytitle(% agreement, margin(medium) size(small)) legend(off) /// ylabel(0 0.2 "20" 0.4 "40" 0.6 "60" 0.8 "80" 1.0 "100", labsize(vsmall)) /// bar(1, color(gs7)) bar(2, color(gs7)) bar(3, color(gs7)) /// bar(4, color(gs7)) bar(5, color(gs7)) bar(6, color(gs7)) /// bar(7, color(gs7)) bar(8, color(gs7)) bar(9, color(gs7)) /// bar(10, color(gs7)) bar(11, color(gs7)) bar(12, color(gs7)) /// bar(13, color(gs7)) bar(14, color(gs7)) bar(15, color(black)) /// graphregion(color(white)) /// note("...", /// size(vsmall) span margin(0 0 0 8))
I know that I could achieve what I want with asyvars. Unfortunately, asyvars makes all the labels into a legend, which does not work for me.
Do you know how to either change the color of a single bar without asyvars, or use asyvars keeping the labels instead of a legend?
Thank you!
Comment