How to imput CIs in a ggline plot

Hi.
I'm a student in biology and just begin working with RStudio.
I'm building a ggline plot with the jitter option. I see that the error bars that are used by default to creat the plot are the standard errors ("mean_se") of the data set. I'd like to replace them with confidence intervals (level 95%) but i don't know how to do that. I tried replacing "mean_se" with "mean_ci" but it doesn't seem to work and i don't know if i need to put an argument in mean_ci 's brackets.
I'd really appreciate some help.
Thank you

Can you provide a reproducible example?

Otherwise, have a look at these articles. You should be able to do what you need.

Ok.
That is part of my data set

supp masse temps (semaine)
bac 1 20 0
bac 1 20 0
bac 1 26 0
bac 1 28 0
bac 1 29 0
bac 1 31 0
bac 1 31 0
bac 1 32 0
bac 1 33 0
bac 1 35 0
bac 1 39 0
bac 1 40 0
bac 1 44 0
bac 1 44 0
bac 1 47 0
bac 1 49 0
bac 1 51 0
bac 1 54 0
bac 1 56 0
bac 1 58 0
bac 1 60 0
bac 1 53 0
bac 1 20 2
bac 1 36 2
bac 1 26 2
bac 1 28 2
bac 1 37 2
bac 1 30 2
bac 1 58 2
bac 1 36 2
bac 1 26 2
bac 1 44 2
bac 1 35 2
bac 1 59 2
bac 1 45 2
bac 1 41 2
bac 1 44 2
bac 1 67 2
bac 1 39 2
bac 1 44 2
bac 1 52 2
bac 1 58 2
bac 1 59 2
bac 1 52 2
bac 1 21 3
bac 1 34 3
bac 1 24 3
bac 1 28 3
bac 1 38 3
bac 1 29 3
bac 1 56 3
bac 1 44 3
bac 1 35 3
bac 1 35 3
bac 1 38 3
bac 1 77 3
bac 1 41 3
bac 1 45 3
bac 1 45 3
bac 1 64 3
bac 1 47 3
bac 1 57 3
bac 1 56 3
bac 1 58 3
bac 1 59 3
bac 1 58 3
bac 1 27 6
bac 1 42 6
bac 1 25 6
bac 1 29 6
bac 1 29 6
bac 1 30 6
bac 1 59 6
bac 1 41 6
bac 1 34 6
bac 1 35 6
bac 1 39 6
bac 1 75 6
bac 1 44 6
bac 1 51 6
bac 1 46 6

and I only use this line of code in order to create the plot :

ggline(scatter.plot.masse, x = "temps(semaine)", y = "masse", add = c("mean_se", "jitter"))

It is the "mean-se" in bold that i'd like to replace with a confidence interval (level 95%) to appear in my plot.

Can't you just use add = c("mean_ci", "jitter")?

From Line plot — ggline • ggpubr

add
character vector for adding another plot element (e.g.: dot plot or error bars). Allowed values are one or the combination of: "none", "dotplot", "jitter", "boxplot", "point", "mean", "mean_se", "mean_sd", "mean_ci", "mean_range", "median", "median_iqr", "median_hilow", "median_q1q3", "median_mad", "median_range"; see ?desc_statby for more details.

Then when you run ?desc_statby is says it is a 95% CI on the mean.

I don't know why i didn't even think about it. It worked !
Thank you so much for replying that fast and being available.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.