library(readr) library(yarrr) # Load the packages (may need to install these if you don't have them) library(plotrix) library(ggplot2) library(rcartocolor) # For colourblind-friendly palettes AB_TemporalPredictability <- read_csv("AB_TemporalPredictability_for_R.csv") # Read the CSV (make sure this is in the working directory) AB_TemporalPredictability_Blink <- read_csv("AB_TemporalPredictability_Blink_for_R.csv") # Read the CSV (make sure this is in the working directory) png('Figure3.png', width = 7.5, height = 5, units = 'in', res = 300) par(mar=c(4,5,2,1)) layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(3,2)) pirateplot(formula = Accuracy ~ Lag + ITI, data = AB_TemporalPredictability, xlab = "Condition + Lag", #x label ylab = "Proportion T2 correct", # ylabel main = "T2 Accuracy", # uncomment this if you want a title theme = 2, # uses one of the inbuilt themes pal = "google", # colour palette back.col = gray(.98), # Add light gray background gl.col = "gray", # Gray gridlines gl.lwd = c(.75, 0), # grid line weight sortx = 'sequential', # sort x in the order it's in in the data inf.f.o = .6, # Turn up inf filling # inf.disp = "bean", # Wrap inference around bean bean.b.o = .2, # Turn down bean borders bean.f.o = .1, # Turn down bean fill quant = c(.1, .9), # 10th and 90th quantiles point.o = .5, point.pch = 21, point.bg = "white", point.col = "black", quant.col = "black")# Black quantile lines pirateplot(formula = BlinkMagnitude ~ ITI, data = AB_TemporalPredictability_Blink, # xlab = "Condition + Lag", #x label ylab = "Blink Magnitude (Lag 8 - Lag 3)", # ylabel main = "Blink Magnitude", # uncomment this if you want a title theme = 2, # uses one of the inbuilt themes pal = "google", # colour palette back.col = gray(.98), # Add light gray background gl.col = "gray", # Gray gridlines gl.lwd = c(.75, 0), # grid line weight sortx = 'sequential', # sort x in the order it's in in the data inf.f.o = .6, # Turn up inf filling # inf.disp = "bean", # Wrap inference around bean bean.b.o = .2, # Turn down bean borders bean.f.o = .1, # Turn down bean fill quant = c(.1, .9), # 10th and 90th quantiles point.o = .5, point.pch = 21, point.bg = "white", point.col = "black", quant.col = "black")# Black quantile lines dev.off() ### Order effects png('TrialOrder.png', width = 8, height = 6.5, units = 'in', res = 300) q <- ggplot(data = AB_TemporalPredictability_Blink, aes(x = ITI, y = BlinkMagnitude, color = TrialOrder, group = Participant)) ## Seprate colours on the graph based on the Trial Order variable q + geom_line() + geom_point() + theme_classic() + theme(text = element_text(size=14)) + ylab("Blink Magnitude (Lag 8 - Lag 3)")+ xlab ("ITI Condition") + scale_color_carto_d(name = "Trial Order ", palette = "Safe") dev.off()