Unable to plot Double Bar, Bar plot using pyplot for ndarray

np.arange(2) gives array([0, 1]), so only two values. If you try to plot three values (in y1 or y2) against this, that won’t work and it will throw the ValueError (telling you exactly this):

ValueError: shape mismatch: objects cannot be broadcast to a single shape

Try using np.arange(3).

Leave a Comment