rm(list=ls())
library(ggpubr)
data("ToothGrowth")
library(ggsci)
pal = pal_lancet("lanonc" )(9)
colors = pal_lancet("lanonc")(9)[ 1:3]
my_comparisons = list(c("0.5","1"),c("1","2"), c("0.5","2"))
p = ggboxplot( ToothGrowth , x = "dose", y = "len", color = "dose" , palette =colors,
bxp.errorbar = T) +
stat_compare_means(comparisons = my_comparisons) +
stat_compare_means(method = "anova" , label.x = 1.7, label.y = 45)
p
p + stat_boxplot(geom ="errorbar", color = colors, width =0.4, size =1) +
geom_boxplot(aes(color = dose))