I have the following data where A and B belong to two different categories; additionally within A and B, A1 (or B1) belong to subcategories of A and B. In other words, A1 is in one subcategory and A2 and A3 in another. Similarly for B.
labels= ['A1', 'A2', 'A3', 'B1', 'B2', 'B3']
values= [2, 4, 3, 2.5, 3.5, 4]
I would like to do a bar plot where A and B categories as well as sub categories are separated (preferably by different colors). My attempt is:
import matplotlib.pyplot as plt
import numpy as np
index = np.arange(len(labels))
plt.bar(index, values)
plt.ylabel('Values', fontsize=14)
plt.xticks(index, labels, fontsize=14)
plt.show()
How can I customize the spacing/coloring between the bars?