AB <- read_csv("data/ABAB.csv", show_col_types = FALSE)
AB$Case <- paste0("Student ", AB$Case, sep = "")
AB.plot <- AB %>%
ggplot(aes(Session, Outcome)) +
geom_line(data = subset(AB, AB$Phase == "Baseline1"), aes(linetype='1'), linewidth = 0.5) +
geom_line(data = subset(AB, AB$Phase == "Baseline1.Predict"), aes(linetype='2'), linewidth = 0.5) +
geom_line(data = subset(AB, AB$Phase == "Intervention1"), aes(linetype='1'), linewidth = 0.5) +
geom_line(data = subset(AB, AB$Phase == "Intervention1.Predict"), aes(linetype='2'), linewidth = 0.5) +
geom_line(data = subset(AB, AB$Phase == "Baseline2"), aes(linetype='1'), linewidth = 0.5) +
geom_line(data = subset(AB, AB$Phase == "Intervention2"), aes(linetype='1'), linewidth = 0.5) +
geom_point(size = 2.5) +
theme_minimal(base_size = 13) +
theme(
plot.title = element_text(face = "bold", size = 15),
legend.position ="top",
panel.grid.major = element_line(colour = "grey95", linewidth = 0.2),
panel.grid.minor = element_blank(),
legend.text = element_text(size = 13),
legend.title = element_text(size = 13, hjust = 0.5),
strip.text.x = element_text(color = "#3B3B3B", size = 13),
axis.text.x = element_text(size = 13, color = "#3B3B3B"),
axis.text.y = element_text(size = 13, color = "#3B3B3B"),
axis.title = element_text(face = "bold", size = 13, color = "#3B3B3B")
) +
labs(
x = "Session",
y = "Correct Percentage (%)"
) +
guides(linetype="none") +
geom_vline(aes(xintercept = 3.5), linetype = "longdash", linewidth = 0.3, color = "grey10") +
geom_vline(aes(xintercept = 8.5), linetype = "longdash", linewidth = 0.3, color = "grey10") +
geom_vline(aes(xintercept = 12.5), linetype = "longdash", linewidth = 0.3, color = "grey10") +
annotate(geom = "text", x = 2, y = 95, label = "Baseline", color = "#0000FF", fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 6, y = 95, label = "Intervention", color = "#0000FF", fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 10.5, y = 95, label = "Baseline", color = "#0000FF", fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 15, y = 95, label = "Intervention", color = "#0000FF", fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 6, y = 25, label = "Prediction", color = 'red', fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 10.5, y = 5, label = "Verification", color = 'red', fontface = 'bold', size = 5.5) +
annotate(geom = "text", x = 15, y = 75, label = "Replication", color = 'red', fontface = 'bold', size = 5.5) +
annotate("rect", xmin = 3.8, xmax = 8.3, ymin = 0, ymax = 20, alpha = .2) +
annotate("rect", xmin = 8.8, xmax = 12.3, ymin = 60, ymax = 90, alpha = .2)
AB_plot <- AB.plot %>% ggplotly(height = 350) %>% layout(dragmode = "select")