I'm trying to control the color of individual bars in a BarChartwhen I pass a 2 dimensional list of data to plot. What I want to accomplish is that for each pair of adjacent bars I want to use a ColorScheme overall, however, make the right bar to be slightly Darker (see the last image for an example). No color is repeated.
I've tried various combinations of {..., {None}, etc...}, however, I can't figure out how to do what I want without flattening the list.
BarChart[RandomReal[1, {5, 2}], ChartStyle -> "Pastel"]

BarChart[RandomReal[1, {5, 2}], ChartStyle -> {"Pastel", None}]

I thought these might work:
colorfunc = ColorData["Pastel"];
colors = colorfunc /@ Range[0, 1, 1/4];
BarChart[RandomReal[1, {5, 2}],
ChartStyle -> {{colors, Darker/@colors}, None}]
but it returns an error.
BarChart[RandomReal[1, {5, 2}], ChartStyle -> {Riffle[colors, Darker[#, 0.1] & /@ colors]}]

As I said I can accomplish what I want by flattening the list but this breaks the nice bar spacing and a lot of the automated features of the plotting.
BarChart[Flatten@RandomReal[1, {5, 2}], ChartStyle -> Riffle[colors, Darker[#, 0.1] & /@ colors]]

How can I control specific specific bars in a BarChart with multi-dimensional data?
Comments
Post a Comment