ax.annotate
is not working for this particular column
. However, it is working for all the other columns
in the dataset
. Unable to understand why. Any help would be appreciated.
plt.figure(figsize=(15, 8))
sns.countplot(x = 'How many employees does your company or organization have?', data = df)
plt.xticks(rotation = 45, fontsize = 15, ha = "right")
plt.yticks(fontsize = 15)
plt.xlabel('How many employees does your company or organization have?', fontsize = 15)
plt.ylabel('Count', fontsize = 15)
plt.title('Entire Data')
for p in ax.patches:
width, height = p.get_width(), p.get_height()
x, y = p.get_xy()
ax.annotate(f'{height/df.shape[0]:.0%}', (x + width/2, y + height + 1), ha='center', fontsize = 15)
plt.show()