'Formatting a line graph in R

My code is a little different from the codes that people usually use when addressing this problem. I am trying to make some formatting adjustments to my code, including adding points to my line graph, and changing the color of the lines and error bars. Thanks in advance!

Reproducible sample:

set.seed(42)
n <- 100

    dat <- data.frame(Participant=1:n, 
                      Environment=rep(LETTERS[1:2], n/2),
                      Condition=rep(LETTERS[25:26], n/2),
                      Gate= sample(1:5, n, replace=TRUE),
                      Block = sample(1:2, n, replace=TRUE),
                      Sound=rep(LETTERS[3:4], n/2),
                      Correct=sample(0:1, n, replace=TRUE)
    )

Code:

dat %>% 
  group_by(Condition, Gate = fct_inorder(Gate), Sound) %>% #these relevant columns
  summarize(Accuracy = mean(Correct), #Defining y axis title 
            sd = sd(Correct)/sqrt(length(Correct))) %>%     #and SD
  ggplot(aes(x = Gate, y = Accuracy, color = Sound, group = Sound)) + 
  geom_line() + 
  geom_errorbar(aes(ymin = Accuracy - sd, ymax = Accuracy + sd,)) + 
  scale_y_continuous(labels = scales::percent)+ 
  facet_wrap(~Condition) + 
  theme_minimal()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source