Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Barplot with exact numbers printed in plot
#Barplots with exact numbers
data(tips, package = "reshape2") # load some data
tips %>%
group_by(sex, smoker) %>%
summarise(mean_group = mean(tip)) %>%
ggplot(aes(x = smoker, y = mean_group,
color = sex, shape = smoker,
group = sex,
label = round(mean_group, 2))) +
geom_point() +
geom_line() +
geom_text(aes(x = smoker, y = mean_group + 0.03))
# see figure online here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.