6. Grouped Bar chart#

  • Specify the categorical Column in ‘hue’

import seaborn as sns
import pandas as pd
data = {'Month':['Jan','Jan','March','April'],
        'Sales': [99, 102, 95, 120],
        'Profit': [10,20,30,40],
        'Country': ['India','Nepal','Nepal','India']
       }
df=pd.DataFrame(data)
sns.barplot(
x='Month',
y='Sales',
data=df.sort_values(by='Profit'), # Sorting the data in charts
hue='Country'
);
../_images/9cc9bdf9108c038f28c22333625f28e9bfdc5439792de1001851b34c988fc04f.png