Closed RachellyN closed 1 month ago
Your seaborn plot is not using stacked bars. When you set dodge=False
the bars will be layered on top of each other.
Thank you @mwaskom ! Is it possible to plot a stacked barplot with seaborn.barplot or does it require a different kind of plot type?
barplot
doesn't' support stacking, sorry!
Hi! I'm trying to create a stacked bar plot from the given file that includes counts of 6 categories across 4 patients. The barplot that seaborn is creating is totally wrong - in the amount of total counts per patients as well as the counts per category. In the example code below I show this, and how a barplot in pandas creates the plot correctly. This has happened in 2 different seaborn versions: V0.13.2 and V0.11.2 (matplotlib version is 3.7.5 in both cases).
Here is the data (df in the code), also available in the attached file:
Here is the example code:
Seaborn plot:
Pandas plot:
seaborn_counts.csv