data2 <- data.frame(exp = as.numeric(data[,1]),cluster = as.factor(cluster$细分))
my_comparisons <- list( c(“I”, “II”), c(“I”, “III”), c(“II”, “III”) ) ## 两两比较的分组
ggplot(data = data2, aes(x = cluster , y = exp,fill=cluster)) +
stat_compare_means(comparisons = my_comparisons,label.y = c(0.10,0.12,0.14))+ # Add pairwise comparisons p-value
stat_compare_means(label.y = 0.16, label.x = 1.5) + ### 添加总体的检验
geom_violin(trim=F,color=”white”,width = 0.9) +
geom_boxplot(outlier.size=NA, size=0.01, outlier.shape = NA,width = 0.1,fill = “#FFFFFF”)+ #绘制箱线图
scale_fill_manual(values = c(“#00676B”, “#EC870E”,”#BC3C28”))+ #设置填充的颜色
theme_bw()+ #背景变为白色
ylim(0,0.01) +
theme(axis.text.x=element_text(hjust = 0,colour=”black”,size=10), #设置x轴刻度标签的字体显示倾斜角度为15度,并向下调整1(hjust = 1),字体簇为Times大小为20
axis.text.y=element_text(size=10,colour=”black”), #设置y轴刻度标签的字体簇,字体大小,字体样式为plain
axis.title.y=element_text(size = 10,colour=”black”), #设置y轴标题的字体属性
legend.text=element_text(colour=”black”, #设置图例的子标题的字体属性
size=10),
legend.title=element_text(colour=”black”, #设置图例的总标题的字体属性
size=10),
panel.grid.major = element_blank(), #不显示网格线
panel.grid.minor = element_blank())+ #不显示网格线
labs(title = “SKCM”) +
ylab(colnames(data)[1]) #设置y轴的标题