-2

enter image description here

I would like to generate graphs in this format, does anyone have code to be able to generate

Masmok
  • 1
  • We don't work on such broad questions here on stackoverflow. There are several high quality plotting packages written for python. But you'll have to research which one you might want to use. – tdelaney Oct 19 '22 at 01:08

1 Answers1

2

you can use de matplotlib library, i think you can use the Horizontal stacked bar plot. Here is an example of how you can use it:

 import pandas as pd
from matplotlib import pyplot as plt

df = pd.DataFrame({
    "height_2019":[40, 12, 10, 26, 36,39],
    "height_2020":[19, 8, 30, 21, 38,29],
    "height_2021":[10, 10, 42, 17, 37,23]
    }, index=['John','Jack','Sam','Shane','Smith','Bill'])

df.plot(kind='barh',figsize=(8,8),stacked=True)
plt.show()
KSGA
  • 21
  • 1