I have this code that thanks to everyone who helped me so far, I am trying to add error bar but it does not work
library(dplyr)
library(readr)
library(ggplot2)
url <- "https://raw.githubusercontent.com/MohJumper/VisualAuditoryModality/master/clean_test_master2.csv"
clean_test_master2 <- read.csv(url)
# code been used
clean_test_master2 %>%
mutate(Reproduction_Type = case_when(
visbility == 1 & soundvolume == 0 ~ "Visual",
visbility == 0 & soundvolume == 1 ~ "Auditory",
visbility == 0 & soundvolume == 0 ~ "Empty")) %>%
mutate_at(vars(Reproduction_Type), factor) %>%
mutate(Opening_text_new = ifelse(Opening_text == "Now focus on the Image", "Now Attend to Visual",
"Now Attend to Auditory")) %>%
ggplot(aes(x = stim_ending_t, y = m, color = Reproduction_Type)) +
geom_line(aes(linetype = Reproduction_Type)) +
geom_point(aes(color = Reproduction_Type, shape = Reproduction_Type))+
scale_x_continuous(name = "Sample Durations in Seconds",limits=c(1, 3.5)) +
scale_y_continuous(name = "Mean Responses", limits=c(1, 3.5)) +
geom_abline(intercept = 0, slope = 1, linetype="dashed") +
theme_bw() +
theme(legend.background = element_rect(fill = "darkgray"),
legend.key = element_rect(fill = "white", color = NA),
legend.key.size = unit(1.9, "cm"),
axis.title.y=element_text(size=15),
axis.text.x=element_text(size=15),
legend.key.width = unit(0.01,"cm")) +
facet_wrap(~Opening_text_new)
Here are the lines I tried but did not work:
geom_errorbar(aes(ymax=stim_ending_t+m, ymin=stim_ending_t-m), width=0.2, size=1, color="black") +
geom_errorbar(data=new_ce, mapping=aes(x = stim_ending_t, ymin=upper, ymax=lower), width=0.2, size=1, color="black") +