I have the following DataFrame on a Jupyter notebook which plots using seaborn a barplot:
data = {\'day_index\': [0, 1, 2, 3, 4, 5, 6],
I think you don't need to specify hue
parameter in this case:
In [136]: ax = sns.barplot(data=dfGroupedAgg, \
...: x='day_index', \
...: y='avg_duration', \
...: palette=sns.color_palette("Reds_d", n_colors=7, desat=1))
...:
you can add amount of trips as annotations:
def autolabel(rects, labels=None, height_factor=1.05):
for i, rect in enumerate(rects):
height = rect.get_height()
if labels is not None:
try:
label = labels[i]
except (TypeError, KeyError):
label = ' '
else:
label = '%d' % int(height)
ax.text(rect.get_x() + rect.get_width()/2., height_factor*height,
'{}'.format(label),
ha='center', va='bottom')
autolabel(ax.patches, labels=df.trips, height_factor=1.02)