Adding annotations option (attributes) to barplot and countplot
See original GitHub issueI propose for adding annotations option (attributes) to barplot and countplot
Lets start with an example
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
df = sns.load_dataset('tips')
Plotting a simple barplot
splot = sns.barplot(data=df, x = 'sex', y = 'total_bill')
Annotating bars
plt.figure(figsize=(6, 8))
splot = sns.barplot(data=df, x = 'sex', y = 'total_bill', ci = None)
for p in splot.patches:
splot.annotate(format(p.get_height(), '.2f'), (p.get_x() + p.get_width() / 2., p.get_height()), ha = 'center', va = 'center', xytext = (0, 10), textcoords = 'offset points')
This seems a simple addition. But, someone requiring to add some more highlights by annotating those bar would require to add some more lines of code.
Instead, adding a single attribute would reduce this efforts and make them more expressive !!!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:5 (1 by maintainers)
I would really like to see this or something like this added.
The annotation on barplots should be simple.
I won’t be adding this, sorry.