Skip to content

Instantly share code, notes, and snippets.

@arvi1000
Created October 26, 2016 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvi1000/e79b3c190690645ff18e23f7bc9f0920 to your computer and use it in GitHub Desktop.
Save arvi1000/e79b3c190690645ff18e23f7bc9f0920 to your computer and use it in GitHub Desktop.
Roughly replicating Erica's plot
library(ggplot2)
# random data
set.seed(5)
my_data <- data.frame(y = rnorm(15*5, mean=0, sd=2) + 3,
x = rep(letters[1:5], each=5))
# plot: jittered points + boxplot overlay
ggplot(my_data, aes(x=x, y=y)) +
geom_jitter(aes(color=x, shape=x), width = 0.2) +
geom_boxplot(fill=NA, size=0.2, outlier.shape = NA) +
geom_hline(yintercept=0.5, linetype='dotted', color='red') +
theme_classic() +
theme(legend.position = 'none')
@arvi1000
Copy link
Author

image

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