'python stacked bar plot with multiple items per stack

I have a pandas df as follows:


TYPE      CAR     COUNT
Sedan    Honda     50
Sedan   Toyota     100
Sedan   Mazda      25
SUV     Honda      10
SUV     Toyota     25
SUV    Mazda       50

I am looking to build a stacked bar chart with:

  1. TYPE on the x-axis
  2. CAR and COUNT on the y-axis with COUNT governing the size of the bar. So we would have 2 bars, one for Sedan and one for SUV each having 3 colored stacks and in the case of Sedan the size of the bar for Toyota would be 4 times the size of Mazda and twice that of Honda How can I do this in either seaborn or matplotlib? Thanks!


Solution 1:[1]

After some more searching, Stacked bar using group by in Python dataframe answered my question...hence closing this!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 FlyingPickle