Please bear with me as I'm quite new to R and specially to ggplot(). This is the second time I'm asking something regarding the use of this function. I would like to create a plot which resembles the one below:
I've been using a script looking like this for such purpose:
df <- tibble::tribble(~Proportion, ~Error, ~Time,
0.351 , 0.154, "Day",
0.223 , 0.157 , "Night")
dfnew <- df %>%
mutate(ymin = Proportion - Error,
ymax = Proportion + Error)
p <- ggplot(data = dfnew, aes(x = Time, y = Proportion)) +
geom_point() + geom_line(aes(group = 1), color="lightblue",size=2) +
geom_errorbar(aes(x = Time, ymin = ymin, ymax = ymax),color="purple",width=0.1,size=1)
p<-p+theme(axis.text=element_text(size=12),
axis.title=element_text(size=14))
However, I now face the problem of having data for confidence intervals that includes the upper and lower values, instead of an error value as I have on the script above. My data looks like this:
> df
# A tibble: 2 x 4
Average Lower Upper Time
<dbl> <dbl> <dbl> <chr>
1 0.351 0.284 0.421 Day
2 0.223 0.178 0.275 Night
Any idea on how I can implement this two Lower and Upper values into error bars?
Any input is appreciated!


aes()eggeom_errorbar(aes(y= Average, ymin = Lower, ymax = Upper))? - Nate> dfnew <- df %>% + mutate(ymin = Proportion - Lower, + ymax = Proportion + Upper) > p <- ggplot(data = dfnew, aes(x = Time, y = Proportion)) + + geom_point() + geom_line(aes(group = 1), color="lightblue",size=2) + + geom_errorbar(aes(y= Proportion, ymin = Lower, ymax = Upper),color="purple",width=0.1,size=1) Warning: Ignoring unknown aesthetics: y > p<-p+theme(axis.text=element_text(size=12), + axis.title=element_text(size=14))- juansalixgeom_errorbar()is complaining about they = AverageI said you should include (my b). The errorbar only wants to know the high and the low, so it ignored the y. Removing they =should remove the warning - Nate