Created
June 28, 2016 12:00
Barplot with exact numbers printed in plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Barplots with exact numbers | |
data(tips, package = "reshape2") # load some data | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
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 http://rpubs.com/sebastiansauer/192499 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment