Complete the code to import the matplotlib library with the common alias.
import [1] as plt
We import the pyplot module from matplotlib as plt to create plots.
Complete the code to create a horizontal bar chart using plt.barh.
plt.[1](categories, values)The function barh creates horizontal bar charts.
Fix the error in the code to correctly position grouped bars horizontally.
plt.barh(y_pos + [1], values2, height=bar_width, label='Group 2')
Adding bar_width shifts the second group bars to the right for grouping.
Fill both blanks to create y positions and set bar width for grouped horizontal bars.
y_pos = np.arange(len(categories)) bar_width = [1] plt.barh(y_pos, values1, height=[2], label='Group 1')
Setting bar_width and height to 0.35 controls bar thickness and spacing.
Fill all three blanks to complete the code for horizontal grouped bars with labels and legend.
plt.barh([1], values1, height=bar_width, label='Group 1') plt.barh([2] + [3], values2, height=bar_width, label='Group 2') plt.yticks(y_pos + bar_width / 2, categories) plt.legend() plt.show()
The first bar group is at y_pos, the second is shifted by bar_width for grouping.
