Skip to content

Instantly share code, notes, and snippets.

@michaeldorman
Created February 15, 2021 19:12
Show Gist options
  • Save michaeldorman/48d8e3ad518891057a190aa3149c1e29 to your computer and use it in GitHub Desktop.
Save michaeldorman/48d8e3ad518891057a190aa3149c1e29 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(wesanderson)
mean_steps <- read.csv("data.csv", stringsAsFactors = FALSE)
cols = c("#FF0000", "#00A08A", "#F2AD00")
cols2 = paste0(cols, "80")
cols = c(rbind(cols2, cols))
ggplot(data=mean_steps,aes(x = trial, y = mean_same, color = paste(block, actor))) +
stat_summary(fun="mean",position=position_dodge(width=0.1),
geom="line" ,size=2) +
geom_hline(yintercept = 50,linetype="dashed", color = "grey",size=1)+
scale_y_continuous(name="Percentage correct chosen (%)", breaks = seq(0, 100, 25)) +
scale_x_continuous(name="Trial", breaks = seq(0, 20, 4)) +
facet_wrap(.~block, strip.position="top")+
scale_color_manual(values=cols) +
theme(
legend.title = element_blank(),
axis.title.x = element_text(size = 10, vjust = -0.35),
axis.title.y = element_text(size = 10, vjust = 0.5),
axis.text.x = element_text(size = 8, vjust = 0.5),
axis.text.y = element_text(size = 8, vjust = 0.5)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment