My question directly relates to How to embed matplotlib in pyqt - for Dummies. The graph is a line chart in the original post. How do I change the type to area or bar chart?
I tried this ax.plot(data, kind="area")
but it does not work.
Furthermore, I want to illustrate pandas pivot in PyQt. I usually use this code pivot_number.plot(kind='area', stacked=True)
to show pivot on Matplotlib. How should I change the original post to pandas pivot?
This is the Pandas Pivot.
pivot_number = cohorts.pivot(columns="cohort_group", index="year", values='total_customers')
cohort_group 2010 2011 2012 2013 ... 2016 2017 2018 2019
year ...
2010 552.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
2011 496.0 128.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
2012 448.0 92.0 152.0 0.0 ... 0.0 0.0 0.0 0.0
2013 408.0 80.0 116.0 132.0 ... 0.0 0.0 0.0 0.0
2014 388.0 64.0 104.0 128.0 ... 0.0 0.0 0.0 0.0
2015 360.0 64.0 68.0 108.0 ... 0.0 0.0 0.0 0.0
2016 348.0 56.0 72.0 100.0 ... 100.0 0.0 0.0 0.0
2017 320.0 52.0 64.0 76.0 ... 88.0 188.0 0.0 0.0
2018 300.0 44.0 68.0 64.0 ... 80.0 172.0 64.0 0.0
2019 284.0 32.0 56.0 56.0 ... 72.0 156.0 52.0 88.0
pivot_number.plot(kind='area', stacked=True)