Given a dataset:
x = [3, 2, 4, 6, 7]
y = ['a','a','b','b','c']
Here variables a
and b
are repeated twice. My requirement is to plot the bar graph for each variable and for variables a and b, we need a separate bar for each a and b.
I was trying to plot a horizontal bar graph using the code:
plt.barh(y, x)
Here the value of a
and b
are stacked and plotted in a single bar. Please help with this.