import numpy as np
import matplotlib.pyplot as plt
N = 5
men_means = (20, 35, 30, 35, 27)
men_std = (2, 3, 4, 1, 2)
ind = np.arange(N) // the x locations for the groups
width = 0.35 // the width of the bars
fig, ax = plt.subplots()
rects1 = ax.bar(ind, men_means, width, color="r", yerr=men_std)
women_means = (25, 32, 34, 20, 25)
women_std = (3, 5, 2, 3, 3)
rects2 = ax.bar(ind + width, women_means, width, color="y", yerr=women_std)
// add some text for labels, title and axes ticks
ax.set_ylabel("Scores")
ax.set_title("Scores by group and gender")
After Change
import matplotlib.pyplot as plt
men_means, men_std = (20, 35, 30, 35, 27), (2, 3, 4, 1, 2)
women_means, women_std = (25, 32, 34, 20, 25), (3, 5, 2, 3, 3)
ind = np.arange(len(men_means)) // the x locations for the groups
width = 0.35 // the width of the bars