Show labels on bins

Hi everyone,

ggplot(average_values, aes(hour, avg_amt_of_calories, fill = hour))  + 
  geom_col(show.legend = FALSE)

which outputs the following plot

Now I wanna show the value of each bin above/on the bin itself (like we do it with stat_count) so how can it be done.

Thanks,

I think you could add a layer like + geom_text(aes(label = avg_amt_of_calories)) and optionally tweak the text's appearance using parameters like size, family, hjust, vjust, angle, etc. It looks like your data already has the values calculated, so it doesn't look like it would be necessary to perform any additional summary statistics.

1 Like

WOW that was fast, thanks @jonspring

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.