Message Boards Message Boards

0
|
2305 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Specify a ColorFunction for segments in stacked BarCharts?

Dear all,

I would like to use stacked bar charts to visualize the performance of a fitting routine, where datasets generated using a distinct known distribution a, b or c are tested agains each of these distributions. Let's say we have a set of nested associations obtained from a dataset query that contains the number of times a fitted distribution was recognized as distribution a, b or c for each input distribution a, b or c. We now try to visualize the performance using a stacked bar chart:

labels = {"a", "b", "c"};
data = Association[
  Table[a -> 
    Association[Table[a -> RandomInteger[{1, 3}], {a, labels}]], {a, 
    labels}]]
BarChart[data, ChartLabels -> Automatic, ChartLayout -> "Stacked"]

I would now like to highlight the correctly designated fits in a certain color (say green) while graying out the other ones. I have trouble formulating a ColorFunction designation that would do this (i.e. highlight bar segments where the distribution a was recognized as a). Does anybody have ideas?

Any help would be much appreciated! Thanks, Max

POSTED BY: Max Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract