The following code shows a bar in each x-axis value (4 bars in total):
import numpy as np
import matplotlib.pyplot as plt
n = 4
width = 0.35
china = (16,21,23,15)
malaysia = (21,11,21,10)
x = np.arange(n)
p1 = plt.bar(x, malaysia, width, color='b')
p2 = plt.bar(x, china, width, color='r', bottom=malaysia)
plt.xticks(x, ('Round 1', 'Round 2', 'Round 3', 'Round 4'))
plt.ylabel('Points')
plt.title('China v/s Malaysia')
plt.yticks(np.arange(0, 60, 5))
plt.legend((p2[0], p1[0]), ('China', 'Malaysia'))
plt.show()
I am looking to put 3-grouped bars instead of one (same as shown in: 3-Columns bar chart) but for each bar it should contain 2 parts (red and blue) as shown in 1st picture.
Thank you so much