I'm looking for a straight forward way to highlight a single bar in a BarChart
, i.e. a BarChart of country GDP where you highlight your country.
There's a great animation QA with a highlighted bar but I couldn't figure out how to simplify that down to a simple static barchart.
I think it should be via a ColorFunction
rule with a user defined function but I'm not getting it, i.e.
data = Range[6]*2;
f[x_] := If[x == 1, Hue[0.5], Hue[0.2]]
BarChart[data,
ColorFunction -> f,
ChartLabels -> Characters["abcdef"]]
does something similar to what I want but I can't figure out how to change which bar gets highlighted (or why it's that one - for any other number but 1
I lose the highlighted bar).
I would have thought I could specify the ChartLabel
for the data point but I haven't figured out that either.