Морское место ставит ценность в сам бар - PullRequest
0 голосов
/ 31 мая 2018

Можно ли поместить значение в сам бар?

Например, разместите числа 1-4 в центрах этих баров.
Эта гистограмма взята из искомых примеров.

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

1 Ответ

0 голосов
/ 01 июня 2018

Вы можете использовать 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

...