LetzerWille
LetzerWille

Reputation: 5668

seaborn place value into bar itself

Is it possible to place value into bar itself?

For example place numbers 1-4 on centers of these bars.
This bar chart is from searborn examples.

import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.barplot(x="day", y="total_bill", data=tips) 

enter image description here

Upvotes: 0

Views: 47

Answers (1)

phi
phi

Reputation: 11754

You can use matplotlib.pyplot.text

import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.barplot(x="day", y="total_bill", data=tips) 
ax.text( -0.1, 10, '1', fontsize=24)
ax.text(1-0.1, 10, '2', fontsize=24)
ax.text(2-0.1, 10, '3', fontsize=24)
ax.text(3-0.1, 10, '4', fontsize=24)

enter image description here

Upvotes: 1

Related Questions