Итак, я думаю, вы могли бы сделать что-то вроде этого:
import numpy as np
import matplotlib.pyplot as plt
ng = 5 #number of groups
bmw = ..
merc = ..
..
fig, ax = plt.subplots()
index = np.arrange(ng)
bar_width = 0.2
fbmw = ax.bar(index, bmw, bar_width, color='r', label='BMW')
fmerc = ax.bar(index + bar_width, merc, color='b', label='MERC')
...
#don't forget to increase bar_width everytime
ax.set_xlabel('Cars')
ax.set_ylabel('Whatever this is')
ax.set_xticks(index + bar_width/2)
ax.set_xticklabels(('a', 'b', 'c', 'd', 'e'))
ax.legend()
fig.tight_layout()
Поскольку я не знаю, что такое числа и столбцы a, b, c, d, e, я оставил эти метки пустыми.Также я подумал, что у вас уже есть кадры данных для bmw, merc и т. Д., Поэтому я не импортировал их.Надеюсь, это поможет!