Python(Matplotlib/seaborn) - way to build a barplot with color being a key of a third variable?

Viewed 19

Working with the following dataframe:

d={'Country':['Iraq', 'Pakistan', 'Afghanistan', 'Colombia', 'Turkey'], 
'Region':['Middle East', 'Asia', 'Asia', 'South America', 'Middle East'],
'Count':['2400', '1400', '1200', '800', '420']}

Is there a way to plot Country against Count with the colour of each bar being keyed to their respective region? e.g. Iraq and Turkey being Red while Pakistan and Afghanistan being Blue etc..

0 Answers
Related