The objective is to plot a bar that stack as shown below using the Pandas builtin plot module
However, I cannot find any near example that tried to achieve similar objective.
The sample code that I am working is as below:
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt # noqa
matplotlib.use ('TkAgg')
data = {'name': ['Reg 1', 'Reg 1', 'Reg 1','Reg 2', 'Reg 2','Reg 2','Reg 2',
'Reg 3','Reg 3','Reg 3','Reg 3','Reg 3','Reg 4','Reg 4',],
'year': ['a', 'b', 'c','a','a','b','c',
'a','a','b','c','d','f','f'],
'reports': ['ay', 'by', 'cy','ay','ay','ay','cy',
'ay','ay','by','dy','dy','ry','rx']}
df = pd.DataFrame(data)
df_occ=df.apply(pd.Series.value_counts)
ax = df_occ.plot.bar(rot=0)
plt.show ()
Appreciate if someone can link to the appropriate reading material that I might miss. Also, I am open to other library that can achieve the aforementioned objective.

