'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:
TYPEon the x-axisCARandCOUNTon the y-axis withCOUNTgoverning the size of the bar. So we would have 2 bars, one forSedanand one forSUVeach having 3 colored stacks and in the case ofSedanthe size of the bar forToyotawould be 4 times the size ofMazdaand twice that ofHondaHow can I do this in eitherseabornormatplotlib? 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 |
