color with ggboxplot for the error bars

Hello!

I would like to add error bars to ggboxplot in a different color.

ggboxplot(ToothGrowth,x="dose",y="len",error.plot="errorbar",add="mean_se",
+ orientation="horizontal")

If I use the "color" attribute, the boxes take on the color. I just want the error bars to be a different color, please.

Thanks,
Erin

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:

Hi again.

I would like to produce a boxplot that has error bars. The boxplot itself should be black, while the error bars should be red.

Here is the initial code:

 library(ggpubr)
Loading required package: ggplot2
 data(ToothGrowth)
 ggboxplot(ToothGrowth,x="dose",y="len",group="len",
+ add="mean_se",error.plot="errorbar")

Everything is black. Now I add the color attribute:

ggboxplot(ToothGrowth,x="dose",y="len",group="len",
+ add="mean_se",error.plot="errorbar",color="red")

So both the box and the error bars are red.

How would I go about having just the error bars be red, please?
Thank you,
Erin

Here is the solution:

 ggboxplot(ToothGrowth,x="dose",y="len",group="dose",
+ add="mean_se",error.plot="errorbar",add.params=list(color="red"))

Thanks,
Erin