// Make a plot with three groups: One for "In Meeting", one for "On Phone", // and one for "Coding". The plot will also have two bar colors: One for // "Without Caffeine" and one for "With Caffeine". auto withoutCaffeine = [8, 6, 3]; auto withCaffeine = [5, 3, 1]; auto sleepinessPlot = groupedBar( iota(3), [withoutCaffeine, withCaffeine], 0.6, ["W/o Caffeine", "W/ Caffeine"], [getColor(64, 64, 255), getColor(255, 64, 64)] ); auto sleepinessFig = Figure(sleepinessPlot) .title("Sleepiness Survey") .yLabel("Sleepiness Rating") .xLabel("Activity") .legendLocation(LegendLocation.right) .horizontalGrid(true) .xTickLabels( iota(3), ["In Meeting", "On Phone", "Coding"] );
Create an array of bar plots that, when inserted into a Figure, will effectively become a grouped bar plot.