- library(ggplot2)
- library(tidyr)
- library(dplyr)
- data<-data.frame(ID=LETTERS[1:10],T1=runif(10,1,10),T2=rnorm(10,10,1),T3=rpois(10,5))
- dt<- data%>%gather(category,score,-ID)
- ggplot(dt) + aes(category, score) +
- geom_boxplot(aes(fill = category), alpha = 0.4, width = 0.6) +
- scale_fill_manual(values = c("blue", "red", "green")) +
- geom_jitter(aes(color = category), size = 2,
- position = position_jitter(width = 0.15)) +
- scale_color_manual(values = c("blue", "red", "green"))+
- labs(x = NULL) + theme_minimal()