How would I create a clustered and grouped bar chart that looks like this (which was painstakingly created using Excel)?
I have seen examples for Mathematica v6.0 but none for Mathematica v8.0.
The data I used to create this chart is as follows:
"Cluster","KPI","Bar","Value"
"Cluster1","Utilisation","Bar1",92
"Cluster2","Utilisation","Bar1",78
"Cluster3","Utilisation","Bar1",68
"Cluster4","Utilisation","Bar1",56
"Cluster5","Utilisation","Bar1",84
"Cluster1","Availability","Bar1",8
"Cluster2","Availability","Bar1",21
"Cluster3","Availability","Bar1",24
"Cluster4","Availability","Bar1",36
"Cluster5","Availability","Bar1",7
"Cluster1","Utilisation","Bar2",92
"Cluster2","Utilisation","Bar2",78
"Cluster3","Utilisation","Bar2",72
"Cluster4","Utilisation","Bar2",59
"Cluster5","Utilisation","Bar2",67
"Cluster1","Availability","Bar2",8
"Cluster2","Availability","Bar2",16
"Cluster3","Availability","Bar2",23
"Cluster4","Availability","Bar2",31
"Cluster5","Availability","Bar2",23
"Cluster1","Utilisation","Bar3",77
"Cluster2","Utilisation","Bar3",82
"Cluster3","Utilisation","Bar3",78
"Cluster4","Utilisation","Bar3",66
"Cluster5","Utilisation","Bar3",85
"Cluster1","Availability","Bar3",23
"Cluster2","Availability","Bar3",14
"Cluster3","Availability","Bar3",20
"Cluster4","Availability","Bar3",28
"Cluster5","Availability","Bar3",9
"Cluster1","Utilisation","Bar4",100
"Cluster2","Utilisation","Bar4",83
"Cluster3","Utilisation","Bar4",75
"Cluster4","Utilisation","Bar4",59
"Cluster5","Utilisation","Bar4",80
"Cluster1","Availability","Bar4",0
"Cluster2","Availability","Bar4",16
"Cluster3","Availability","Bar4",20
"Cluster4","Availability","Bar4",35
"Cluster5","Availability","Bar4",14
For convenience, here is the same sample data in a different form:
{{"Cluster1", {{92, 8}, {92, 8}, {77, 23}, {100, 0}}},
{"Cluster2", {{78, 21}, {78, 16}, {82, 14}, {83, 16}}},
{"Cluster3", {{68, 24}, {72, 23}, {78, 20}, {75, 20}}},
{"Cluster4", {{56, 36}, {59, 31}, {66, 28}, {59, 35}}},
{"Cluster5", {{84, 7}, {67, 23}, {85, 9}, {80, 14}}}}
Or:
{{"Cluster1",{{"Bar1",{92,8}},{"Bar2",{92,8}},{"Bar3",{77,23}},{"Bar4",{100,0}}}},
{"Cluster2",{{"Bar1",{78,21}},{"Bar2",{78,16}},{"Bar3",{82,14}},{"Bar4",{83,16}}}},
{"Cluster3",{{"Bar1",{68,24}},{"Bar2",{72,23}},{"Bar3",{78,20}},{"Bar4",{75,20}}}},
{"Cluster4",{{"Bar1",{56,36}},{"Bar2",{59,31}},{"Bar3",{66,28}},{"Bar4",{59,35}}}},
{"Cluster5",{{"Bar1",{84,7}},{"Bar2",{67,23}},{"Bar3",{85,9}},{"Bar4",{80,14}}}}}
ChartLayout -> "Percentile"
option inBarChart
, but for multiple clusters, you might have to roll your own. $\endgroup$Needs["BarCharts
"]` you will get a message with a link to a page that shows how to transform the code to V8. The link showed me that your example would be written asBarChart[{{2, 2, 0, 4, 5}, {0.5, 0.5, 0, 0.5, 0.5}} // Transpose, ChartLayout -> "Stacked", ChartStyle -> {Yellow, Black}, Ticks -> {{{1.5, "1, 2"}, {4.5, "3, 4"}}, Automatic}]
. Hopefully that might help. (You may need to check out theChartLabels
examples in theBarChart
documentation.). If no answer is posted I'll have a go at it this afternoon (3-4 hours from now) $\endgroup$