Skip to content

Instantly share code, notes, and snippets.

@shv38339
Created June 3, 2017 06:45
Show Gist options
  • Save shv38339/ea3e396f6ca75f3334d6738d168cae41 to your computer and use it in GitHub Desktop.
Save shv38339/ea3e396f6ca75f3334d6738d168cae41 to your computer and use it in GitHub Desktop.
ggplot(${1:data = }, aes(${2:x = )}) +
geom_histogram(aes(y = ..density..), ${3:binwidth = }, colour = "black", fill = "white") +
geom_density(alpha = .2, fill = "#FF6666") +
geom_vline(aes(xintercept = mean(${4:}), color = "mean"), linetype = "dashed", size = 2) +
geom_vline(aes(xintercept = median(${5:}), color = "median"), linetype = "dashed", size = 2) +
scale_color_manual(name = "Dispersion", values = c(median = "blue", mean = "red"))
@shv38339
Copy link
Author

shv38339 commented Jun 3, 2017

This is an R snippet. Therefore, the following formatted pieces of code, ${#:...}, need to be replaced with actual values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment