Created
November 10, 2017 22:39
-
-
Save gedankenstuecke/ac566f3fcfb9e0b0ff164e8944ee4751 to your computer and use it in GitHub Desktop.
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
library(ggplot2) | |
agree <- rnorm(15000, 3.72, 0.68) | |
concs <- rnorm(15000, 3.63, 0.72) | |
extra <- rnorm(15000, 3.27, 0.89) | |
neuro <- rnorm(15000, 3.21, 0.84) | |
openn <- rnorm(15000, 3.93, 0.67) | |
big5 <- data.frame(agreeableness=agree, | |
conscientiousness=concs, | |
extraversion=extra, | |
neuroticism=neuro, | |
openness=openn) | |
library(tidyr) | |
big5_long <- gather(big5, item, value, agreeableness:openness, factor_key=TRUE) | |
user <- data.frame(item = c("agreeableness", | |
"conscientiousness", | |
"extraversion", | |
"neuroticism", | |
"openness"), | |
value = c(2,4,0,4.5,5)) | |
ggplot(big5_long,aes(big5_long$item, big5_long$value)) + | |
geom_violin() + | |
geom_segment(data=user,aes(x=as.numeric(item)-0.5, | |
xend=as.numeric(item)+0.5, | |
y=value, | |
yend=value, | |
color=item)) + | |
scale_x_discrete("Big 5 Item") + | |
scale_y_continuous("Value") + | |
ggtitle("Your Big 5 Personality Scores.\nPlots in the background give background frequency for your age group") + | |
theme_minimal() + | |
theme(axis.text.x=element_text(angle = 40, hjust = 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will generate this picture: