【无标题】

import matplotlib.pyplot as pltimport numpy as nplabels = [‘A’, ‘B’, ‘C’, ‘D’]men_means = [20, 35, 30, 35]women_means = [25, 32, 34, 20]x = np.arange(len(labels))width = 0.35fig, ax = plt.subplots()rects1 = ax.bar(x - width/2, men_means, width, label=‘Men’)rects2 = ax.bar(x + width/2, women_means, width, label=‘Women’)ax.set_ylabel(‘Scores’)ax.set_xticks(x)ax.set_xticklabels(labels)ax.legend()fig.tight_layout()plt.show()

你可能感兴趣的:(python)