论文中的插图
1 图片样例
2 脚本样例
rm(list=ls())
library(ggpubr)
library(ggsci)
pal = pal_lancet("lanonc" )(9)
df = data.frame(value = c(10.2,14.36,16.82,6.91,10.2,
4.89,10.36,9.52,3.94,4.76,
13.5,16.36,22.38,7.19,11.2,
3.61,9.52,8.42,2.01,3.32),
name = c('KNN','KNN','KNN','KNN','KNN',
'RF','RF','RF','RF','RF',
'MLP','MLP','MLP','MLP','MLP',
'GNet4FL','GNet4FL','GNet4FL','GNet4FL','GNet4FL'),check.names = FALSE)
print(df)
colors = pal_lancet("lanonc")(9)[1:4]
my_comparisons = list(c("KNN","GNet4FL"),c("RF","GNet4FL"),c("MLP","GNet4FL"))
p = ggboxplot( df , x = "name", y = "value", color = "name" , palette =colors,
bxp.errorbar = T) +labs(colour=NULL)+
stat_compare_means(comparisons = my_comparisons) +scale_x_discrete(NULL)+
scale_y_continuous('MAR',breaks=seq(0,30,5))
p
p + stat_boxplot(geom ="errorbar", color = colors, width =0.4, size =1) +
geom_boxplot(aes(color = name))