This script visualise the data.
filepath <- "C:/R/exp_1/results/BEH/merged_group_dataset/"
mergedC <- read_csv(paste0(filepath, "mergedC.csv"))
mergedMA <- read_csv(paste0(filepath, "mergedMA.csv"))
mergedMO <- read_csv(paste0(filepath, "mergedMO.csv"))
mergedM <- read_csv(paste0(filepath, "mergedM.csv"))
allGroups <- read_csv(paste0(filepath, "allGroups.csv"))
mergedC_OL <- read_csv(paste0(filepath, "mergedC_OL.csv"))
mergedMA_OL <- read_csv(paste0(filepath, "mergedMA_OL.csv"))
mergedMO_OL <- read_csv(paste0(filepath, "mergedMO_OL.csv"))
mergedM_OL <- read_csv(paste0(filepath, "mergedM_OL.csv"))
allGroups_OL <- read_csv(paste0(filepath, "allGroups_OL.csv"))
data <- mergedC
# NoGrat
noGratRt_C <-
filter(data,
trialType == "NG", # Only want NoGrat
correctDet == "correct") # Only want correct response
# Set plot contents
noGratRt_C <-
ggplot(noGratRt_C, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# Gratings
gratRt_C <-
filter(data,
trialType == "G",
correctDet == "correct")
# Set plot contents
gratRt_C <-
ggplot(gratRt_C,
aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color=FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# mergedC_plot <- plot_grid(noGratRt_C, gratRt_C, labels = c("A", "B"), ncol = 2, nrow = 1)
# title <- ggdraw() +
# draw_label(
# "All Control - RT Correct Detection",
# fontface = 'bold',
# x = 0,
# hjust = 0) +
# theme(plot.margin = margin(0, 0, 0, 3))
# mergedC_plot <- plot_grid(title, mergedC_plot, ncol = 1, nrow = 2, rel_heights = c(0.05, 1))
# ggsave("C:/MATLAB/exp_1/results/figures/mergedC_plot.png", mergedC_plot, height = 5)
# print(mergedC_plot)
mergedC_plot <- noGratRt_C + gratRt_C +
plot_annotation(title = 'RT Correct Detection - Contol')
# ggsave("C:/MATLAB/exp_1/results/figures/mergedC_plot.png", mergedC_plot, height = 5)
print(mergedC_plot)
mergedC |> filter(correctDet == "correct")|>
group_by(validity, trialType, group) |>
rstatix::get_summary_stats(rtDet, type = "mean_sd")
## # A tibble: 6 × 7
## group trialType validity variable n mean sd
## <chr> <chr> <chr> <fct> <dbl> <dbl> <dbl>
## 1 C G invalid rtDet 466 0.78 0.416
## 2 C NG invalid rtDet 525 0.737 0.401
## 3 C G neutral rtDet 538 0.699 0.387
## 4 C NG neutral rtDet 567 0.681 0.359
## 5 C G valid rtDet 2273 0.654 0.375
## 6 C NG valid rtDet 2305 0.649 0.358
data <- mergedM
# NoGrat
noGratRt_M <-
filter(data,
trialType == "NG", # Only want NoGrat
correctDet == "correct") # Only want correct response
# Set plot contents
noGratRt_M <-
ggplot(noGratRt_M, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# Gratings
gratRt_M <-
filter(data,
trialType == "G",
correctDet == "correct")
# Set plot contents
gratRt_M <-
ggplot(gratRt_M,
aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color=FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# mergedMA_plot <- plot_grid(noGratRt_MA, gratRt_MA, labels=c("A", "B"), ncol = 2, nrow = 1)
# title <- ggdraw() +
# draw_label(
# "All Migraine - RT Correct Detection",
# fontface = 'bold',
# x = 0,
# hjust = 0) +
# theme(plot.margin = margin(0, 0, 0, 3))
# mergedMA_plot <- plot_grid(title, mergedMA_plot, ncol = 1, nrow = 2, rel_heights = c(0.05, 1))
# ggsave("C:/MATLAB/exp_1/results/figures/mergedMA_plot.png", mergedMA_plot, height = 5)
# print(mergedMA_plot)
mergedM_plot <- noGratRt_M + gratRt_M +
plot_annotation(title = 'RT Correct Detection - All Migraine')
# ggsave("C:/MATLAB/exp_1/results/figures/mergedM_plot.png", mergedM_plot, height = 5)
print(mergedM_plot)
mergedM |> filter(correctDet == "correct")|>
group_by(validity, trialType, group) |>
rstatix::get_summary_stats(rtDet, type = "mean_sd")
## # A tibble: 6 × 7
## group trialType validity variable n mean sd
## <chr> <chr> <chr> <fct> <dbl> <dbl> <dbl>
## 1 M G invalid rtDet 538 0.879 0.388
## 2 M NG invalid rtDet 583 0.843 0.412
## 3 M G neutral rtDet 581 0.765 0.351
## 4 M NG neutral rtDet 594 0.748 0.382
## 5 M G valid rtDet 2417 0.725 0.366
## 6 M NG valid rtDet 2444 0.708 0.362
# gratComp <- plot_grid(noGratRt_C, noGratRt_MA, gratRt_C, gratRt_MA, labels=c("NG_C", "NG_M", "G_C", "G_M"), ncol = 2, nrow = 1)
# title <- ggdraw() +
# draw_label(
# "Trial Comparison Between Groups",
# fontface = 'bold',
# x = 0,
# hjust = 0) +
# theme(plot.margin = margin(0, 0, 0, 3))
# gratComp <- plot_grid(title, gratComp, ncol = 1, nrow = 2, rel_heights = c(0.05, 1))
# ggsave("C:/MATLAB/exp_1/results/figures/mergedMA_plot.png", mergedMA_plot, height = 5)
# print(gratComp)
# ggarrange(noGratRt_C, noGratRt_MA, gratRt_C, gratRt_MA, labels=c("NG_C", "NG_M", "G_C", "G_M"), ncol = 2, nrow = 2)
NG_comp <- noGratRt_C + noGratRt_M +
plot_annotation(title = 'RT Correct Detection - NG (C - M)')
G_comp <- gratRt_C + gratRt_M +
plot_annotation(title = 'RT Correct Detection - G Comparison (C - M)')
NG_comp
## Warning: Removed 36 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 36 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 36 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 36 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 35 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 35 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 35 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 35 rows containing missing values or values outside the scale range
## (`geom_point()`).
G_comp
## Warning: Removed 51 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 51 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 51 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 51 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 40 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 40 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 40 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 40 rows containing missing values or values outside the scale range
## (`geom_point()`).
data <- mergedMA
# NoGrat
noGratRt_MA <-
filter(data,
trialType == "NG", # Only want NoGrat
correctDet == "correct") # Only want correct response
# Set plot contents
noGratRt_MA <-
ggplot(noGratRt_MA, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# Gratings
gratRt_MA <- filter(data,
trialType == "G",
correctDet == "correct")
# Set plot contents
gratRt_MA <-
ggplot(gratRt_MA, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# mergedMA_plot <- plot_grid(noGratRt_MA, gratRt_MA, labels=c("A", "B"), ncol = 2, nrow = 1)
# title <- ggdraw() +
# draw_label(
# "All Migraine - RT Correct Detection",
# fontface = 'bold',
# x = 0,
# hjust = 0) +
# theme(plot.margin = margin(0, 0, 0, 3))
# mergedMA_plot <- plot_grid(title, mergedMA_plot, ncol = 1, nrow = 2, rel_heights = c(0.05, 1))
# ggsave("C:/MATLAB/exp_1/results/figures/mergedMA_plot.png", mergedMA_plot, height = 5)
# print(mergedMA_plot)
mergedMA_plot <- noGratRt_MA + gratRt_MA +
plot_annotation(title = 'RT Correct Detection - Migraine')
# ggsave("C:/MATLAB/exp_1/results/figures/mergedMA_plot.png", mergedMA_plot, height = 5)
print(mergedMA_plot)
data <- mergedMO
# NoGrat
noGratRt_MO <-
filter(data,
trialType == "NG", # Only want NoGrat
correctDet == "correct") # Only want correct response
# Set plot contents
noGratRt_MO <-
ggplot(noGratRt_MO, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
# Gratings
gratRt_MO <-
filter(data,
trialType == "G",
correctDet == "correct")
# Set plot contents
gratRt_MO <-
ggplot(gratRt_MO, aes(validity, rtDet, fill = validity)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=validity),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "limegreen", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("invalid", "valid", "neutral"),
labels = c("Invalid", "Valid", "Neutral")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "seagreen1", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
mergedMO_plot <- plot_grid(noGratRt_MO, gratRt_MO, labels=c("A", "B"), ncol = 2, nrow = 1)
ggsave("C:/MATLAB/exp_1/results/figures/mergedMO_plot.png", mergedMO_plot, height = 5)
print(mergedMO_plot)
data <- allGroups_OL
noGratRt_all_val <- filter(data,
trialType == "NG",
correctDet == "correct",
validity == "valid")
# Set plot contents
noGratRt_all_val <-
ggplot(noGratRt_all_val, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Valid No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
gratRt_all_val <- filter(data,
trialType == "G",
correctDet == "correct",
validity == "valid")
# Set plot contents
gratRt_all_val <-
ggplot(gratRt_all_val, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Valid Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
noGratRt_all_val + gratRt_all_val
data <- allGroups
noGratRt_all_inval <-
filter(data,
trialType == "NG",
correctDet == "correct",
validity == "invalid")
# Set plot contents
noGratRt_all_inval <-
ggplot(noGratRt_all_inval, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Invalid No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
gratRt_all_inval <-
filter(data,
trialType == "G",
correctDet == "correct",
validity == "invalid")
# Set plot contents
gratRt_all_inval <-
ggplot(gratRt_all_inval, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Invalid Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
noGratRt_all_inval + gratRt_all_inval
## Warning: Removed 18 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 18 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 18 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 18 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 18 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 18 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 18 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 18 rows containing missing values or values outside the scale range
## (`geom_point()`).
data <- allGroups
noGratRt_all_neut <-
filter(data,
trialType == "NG",
correctDet == "correct",
validity == "neutral")
# Set plot contents
noGratRt_all_neut <-
ggplot(noGratRt_all_neut, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Neutral No Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
gratRt_all_neut <-
filter(data,
trialType == "G",
correctDet == "correct",
validity == "neutral")
# Set plot contents
gratRt_all_neut <-
ggplot(gratRt_all_neut, aes(group, rtDet, fill = group)) +
# Set whiskers
stat_boxplot(geom = 'errorbar',
width = 0.3,
coef = 1.5) +
# Set plot design
geom_jitter(aes(color=group),
width = 0.3,
alpha = 0.1) +
scale_color_manual(values=c("indianred3", "dodgerblue")) +
guides(color = FALSE) +
geom_boxplot(width = 0.5,
alpha = 1,
outlier.shape = NaN) +
# Set mean
stat_summary(fun = mean,
geom = "point",
shape = 18,
size = 3,
show.legend = F) +
# Set major labels (title, Y, X axis)
labs(title = "Neutral Gratings",
x = " ",
y = "RT (Secs)") +
# Rename each X axis character label
scale_x_discrete(limits = c("C", "M"),
labels = c("Control", "Migraine")) +
# Set Y axis range
ylim(0, 2) +
# Set colour
scale_fill_manual(values=c("coral", "cadetblue1")) +
# Plot theme
theme_bw() +
# Remove legend
guides(fill=FALSE)
noGratRt_all_neut + gratRt_all_neut
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
# # NoGrat
# noGratRt_betweenValid <- filter(allGroups,
# validity == "valid",
# trialType == "NG", # Only want NoGrat
# correctDet == "correct") # Only want correct response
# # Set plot contents
# noGratRt_betweenValid <- ggplot(noGratRt_betweenValid, aes(group, rtDet, fill = group)) +
# # Set whiskers
# stat_boxplot(geom = 'errorbar', width = 0.3) +
# # Set plot design
# geom_jitter(aes(color=group), width = 0.3, alpha = 0.1) +
# scale_color_manual(values=c("dodgerblue", "dodgerblue", "dodgerblue")) +
# guides(color=FALSE) +
# geom_boxplot(alpha = 1, outlier.shape = NaN) +
# # Set mean
# stat_summary(fun = mean, geom = "point", shape = 18, size = 3, show.legend = F) +
# # Set major labels (title, Y, X axis)
# labs(title = "RT - Between Groups Valid",
# x = "No Gratings",
# y = "RT (Secs)") +
# # Rename each X axis character label
# scale_x_discrete(limits = c("MA", "MO", "C")) +
# # Set Y axis range
# ylim(0, 3) +
# # Set colour
# scale_fill_manual(values=c("cadetblue1", "cadetblue1", "cadetblue1")) +
# # Plot theme
# theme_bw() +
# # Remove legend
# guides(fill=FALSE)
#
# # Gratings
# gratRt_betweenValid <- filter(allGroups,
# validity == "valid",
# trialType == "G",
# correctDet == "correct")
# # Set plot contents
# gratRt_betweenValid <- ggplot(gratRt_betweenValid, aes(group, rtDet, fill = group)) +
# # Set whiskers
# stat_boxplot(geom = 'errorbar', width = 0.3) +
# # Set plot design
# geom_jitter(aes(color=group), width = 0.3, alpha = 0.1) +
# scale_color_manual(values=c("dodgerblue", "dodgerblue", "dodgerblue")) +
# guides(color=FALSE) +
# geom_boxplot(alpha = 1, outlier.shape = NaN) +
# # Set mean
# stat_summary(fun = mean, geom = "point", shape = 18, size = 3, show.legend = F) +
# # Set major labels (title, Y, X axis)
# labs(x = "Gratings",
# y = "") +
# # Rename each X axis character label
# scale_x_discrete(limits = c("MA", "MO", "C")) +
# # Set Y axis range
# ylim(0, 3) +
# # Set colour
# scale_fill_manual(values=c("cadetblue1", "cadetblue1", "cadetblue1")) +
# # Plot theme
# theme_bw() +
# # Remove legend
# guides(fill=FALSE)
#
# betweenGroupsValid_plot <- plot_grid(noGratRt_betweenValid, gratRt_betweenValid, labels=c("A", "B"), ncol = 2, nrow = 1)
# ggsave("C:/MATLAB/exp_1/results/figures/betweenGroupsValid_plot.png", betweenGroupsValid_plot, height = 5)
# print(betweenGroupsValid_plot)