Khaled Khanfar
Khaled Khanfar

Reputation: 115

plotting negative and positive numbers bar python

I've created function to calculate the percentage of delay and over achieve in percentage for multiple staff but I don't know how to visualize it

For example :

John : (60.0,40.0) # 60.0 delay and 40 percent over achieve

Ellen : (45.0,55.0)

how can i visualize it like the picture attached enter image description here

Upvotes: 0

Views: 1833

Answers (1)

D M
D M

Reputation: 1177

You can use pandas:

import pandas as pd
import seaborn as sns
sns.set()

df = pd.DataFrame([(60,40), (45, 55)], columns=['delay', 'overachive'], 
                  index=['John', 'Ellen'])
df['delay'] = -df['delay']
df.plot(kind='bar', stacked=True);

enter image description here

Upvotes: 2

Related Questions