FunctionRacerProblemsRace

Bars in Pairs

MediummatplotlibPython

Each name has two values to compare: plan[i] and actual[i]. Draw them as two bars side by side per name. Put name i at position i on the x axis; make every bar 0.4 wide, the plan bar centered at i - 0.2 and the actual bar at i + 0.2. Label the two sets "plan" and "actual", show the legend, and show the names as tick labels at the positions 0, 1, 2, ... Return the figure.

Checked: the bars, the x ticks, the x tick labels and the legend.

Example 1

names ["tea","milk","jam"]
plan [3,5,2]
actual [4,4,1]
draws
The chart to draw in example 1 of Bars in Pairs

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More matplotlib problems