Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to display values on top of bar in barplot seaborn

# If you have single graph (matplotlib)
for p in ax.patches:
    ax.annotate(str(p.get_height()), xy=(p.get_x(), p.get_height()))

# if you have single graph (seaborn)
ax = sns.countplot(x='User', data=df)
ax.bar_label(ax.containers[0])

# if you have subplots or multiple graphs
ax = sns.countplot(x='User', hue='C', data=df)
for container in ax.containers:
    ax.bar_label(container)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #display #values #top #bar #barplot #seaborn
ADD COMMENT
Topic
Name
8+5 =