1 // Stack coffee and tea consumption on top of each other. 2 Figure( 3 stackedBar(iota(3), [[5, 3, 1], [1, 2, 3]], 0.6, 4 ["Coffee", "Tea"] 5 ) 6 ).legendLocation(LegendLocation.right) 7 .title("Caffeine Consumption") 8 .xLabel("Time of Day") 9 .xTickLabels(iota(3), ["Morning", "Afternoon", "Evening"]) 10 .yLabel("Beverages") 11 .showAsMain();
Create a stacked bar plot. The usage mechanics are identical to those of the no error bar overload of groupedBar().