1

could you please help how to create a stacked chart as per the image below? preferably in seaborn

import pandas as pd
df2 = pd.DataFrame({'ID':['a','b','c','d'], 'total' : [30,50,30,50], 'match' : [5,12,14,22]})
df2
   ID total match
0   a   30  5
1   b   50  12
2   c   30  14
3   d   50  22

I just draw the 'a' and 'b' IDs..but need for all

enter image description here

The Singularity
  • 2,428
  • 3
  • 19
  • 48
Skittles
  • 121
  • 1
  • 11

1 Answers1

0

So I've done it myself in matplotlib:

ax = df2.plot(x="ID", y="total", kind="barh")
df2.plot(x="ID", y="match", kind="barh", ax=ax, color="C2")

But would still prefer in seaborn:

enter image description here

ouflak
  • 2,458
  • 10
  • 44
  • 49
Skittles
  • 121
  • 1
  • 11