I have a pandas
DataFrame
tha looks like this:
import pandas as pd
temp = pd.DataFrame({'country':['A1','A1','A1','A1','A2','A2','A2','A2'],
'seg': ['S1','S2','S1','S2','S1','S2','S1','S2'],
'agegroup': ['1', '2', '2', '1','1', '2', '2', '1'],
'N' : [21,22,23,24,31,32,33,34]})
and i create the following plot:
sns.factorplot(data=temp, x='seg', y='N', hue='agegroup', row='country', kind='bar',
orient='v', legend=True, aspect=1)
I would like to do the following :
1. rotate it 45 degrees, so that the bars are horizontally and not vertically. I tried this sns.factorplot(data=temp, x='seg', y='N', hue='agegroup', row='country', kind='bar',
orient='h', legend=True, aspect=1)
but i get the following error TypeError: unsupported operand type(s) for /: 'str' and 'int'
2. Have the numbers N
on top of each bar. I tried to follow this
but i couldn't make it work