violinData2$trait <- factor(violinData2$trait,
levels=c("O", "C", "E", "A", "N"))
vioplot(violinData2$score ~
violinData2$long, col = 2:length(levels(violinData2$long)),
xlab = "Trait", ylab = "Score")
custom_theme <- theme(
plot.margin = margin(t = 15, r = 15, b = 15, l = 15),
axis.title.x = element_text(size = 14,
face = 'bold',
color = 'black',
margin = margin(t=15,r=0,b=0,l=0)),
axis.title.y = element_text(size = 14,
face = 'bold',
color = 'black',
margin = margin(t=0,r=15,b=0,l=0)),
axis.text = element_text(size = 12,
color = 'black',
face = 'bold'),
axis.line = element_line(size = 1,
color = 'black'),
axis.ticks = element_line(size = 1,
color = 'black')
)
Plot 1
plot1 <- ggplot(violinData2,
aes(fill=context, x=trait, y=score)) +
geom_violin() +
geom_boxplot(show.legend=FALSE,
notch=TRUE,
color='black',
width=0.3,
position = position_dodge(width=0.9)) +
xlab("Trait") + ylab("Score") +
ggtitle("BFI Score by Trait and Context") +
theme_bw() +
scale_fill_manual(name="Context",
values = c("#696969",
"darkgrey",
"white")) +
theme(plot.title = element_text(hjust = 0.5, face = "bold"),
axis.text = element_text(size = 12),
axis.title = element_text(size = 12, face = "bold"),
legend.title = element_text(size = 12))
plot1
## Warning: Removed 30 rows containing non-finite values (stat_ydensity).
## Warning: Removed 30 rows containing non-finite values (stat_boxplot).