Here is code I\'ve amended from https://matplotlib.org/3.3.3/gallery/lines_bars_and_markers/bar_stacked.html to stack 3 instead of 2 categories : for a stacked barchart: