-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathALL345_analysis2_violinplot.R
40 lines (25 loc) · 1.2 KB
/
ALL345_analysis2_violinplot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
NTUAC2.all <- read.csv('ALL_3_4_5±èV2.csv')
NTUAC2.data <- data.frame(NTUAC2.all)
NTUAC2.data$Session <- as.factor(NTUAC2.data$Session)
NTUAC2.data$Task <- as.factor(NTUAC2.data$Task)
NTUAC2.data$Subject <- as.factor(NTUAC2.data$Subject)
NTUAC2.data$Tag <- as.factor(NTUAC2.data$Tag)
Df.NB <- subset(NTUAC2.data, Task=="NB")
Df.I <- subset(NTUAC2.data, Task=="I")
Df.S <- subset(NTUAC2.data, Task=="S")
library(ggplot2)
library(ggsignif)
library(plotly)
# violin plot
Sub.ACC.violin <- ggplot(NTUAC2.data, aes(x=Subject, y=ACC, fill=Subject)) +
geom_violin(width=1.5, colour = NA) +
# geom_boxplot(width=0.1, fill="white") +
stat_summary(fun.y=mean, geom="point", shape=2, size=3) +
stat_summary(fun.y=median, geom="point", size=2, color="red")
Sub.ACC.violin
Tag.ACC.violin <- ggplot(NTUAC2.data, aes(x=Tag, y=ACC, fill=Task)) +
geom_violin(scale = "width", colour = NA)
# geom_boxplot(width=0.1, fill="white") +
# stat_summary(fun.y=mean, geom="point", shape=2, size=3) +
# stat_summary(fun.y=median, geom="point", size=2, color="black")
Tag.ACC.violin