How to add line for connecting the means of the first quantile and fifth quantile in ggboxplot in R

How to add line for connecting the means of first quantile and fifth quantile in ggboxplot

ggboxplot(testdf, x = "N4_levels", y = "C8",
add =  "jitter",
order = c("0", "0.25", "0.5", "0.75", "1"),   
ylab = "C8 Expres ", xlab = "N4 Expres", bxp.errorbar=TRUE, notch=TRUE)+
        stat_summary(fun=mean, colour="red", shape = 16, size=0.7)

And I was trying to add the following piece of code for adding Line conneting of means of each Quantile, but this is connecting all the means of Quantiles but that's not what I want; the Just first and Fifth Quantile (picture attached).

  stat_summary(fun=mean, colour="red", geom="line", lty="dotdash", lwd =1, aes(group=1)) 

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

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.