Reproducing the data frame as showed :
dx = {'SEGM':[9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
'YES':[4812, 2697, 2677, 1811, 1570, 1010, 418, 210, 115, 166],
'NO':[590, 1368, 2611, 2968, 3942, 3596, 2141, 1668, 1528, 11055],
'TOT':[5402, 4065, 5288, 4779, 5512, 4606, 2559, 1878, 1643, 11221],
'YES%':[89.08, 66.35, 50.62, 37.89, 28.48, 21.93, 16.33, 11.18, 7.0, 1.48],
'TOTCUM%':[11.51, 20.16, 31.43, 41.6, 53.34, 63.15, 68.6, 72.6, 76.1, 100.0]}
dx = pd.DataFrame(dx)
dx
Expected plot in python seaborn/mathplotlib
I have created in excel for better visual expectation
Tried with below but not working
g=sns.barplot(dx.SEGM, dx['YES'], alpha=0.8)
sns.set_style("whitegrid", {'axes.grid' : False})
plt.title(f'{cat_col} with {vol_inperc}%', fontsize = 16,color='blue')
plt.ylabel('Volume', fontsize=12)
plt.xlabel(f'{cat_col}', fontsize=12)
plt.xticks(rotation=90)
for p in g.patches:
height = p.get_height()
g.text(p.get_x()+p.get_width()/2.,
height + 3,
'{}n{:1.2f}%'.format(round(height),height/len(df)*100),
ha="center", fontsize=10, color='blue')
gt = g.twinx()