# 柱形图:bar(left, height, width=0.8, bottom=None, **kwargs)
import matplotlib.pyplot as plt
import numpy as np
size = 5
x = np.arange(size)
a = np.random.random(size)
b = np.random.random(size)
c = np.random.random(size)
# ================并列柱形图===============
width = 0.8 / 3
plt.bar(x - width, a, width=width, color='r', label='a', alpha=0.5)
plt.bar(x, b, width=width, color='b', label='b', alpha=0.5)
plt.bar(x + width, c, width=width, color='g', label='c', alpha=0.5)
plt.legend(loc='upper left')
plt.show()