require(ggplot2) f_SCE_VlnBoxPlot <-function(df, geneN, groupN='groupN'){ p <- ggplot(df, aes(x=!!sym(groupN), y=value, fill=!!sym(groupN), alpha =0.618)) p <- p + theme_bw()+ theme (legend.position ="none") p <- p + geom_violin()# 绘制小提琴图 # p <- p + stat_ydensity(trim = TRUE, scale = 'width', adjust = 1) # 绘制小提琴图 p <- p + geom_boxplot(width=0.618)# 绘制箱型图 p <- p + stat_summary(fun="mean",geom="point",color='white')# 添加均值点 p <- p + labs(x=NULL, y=NULL)# 删除xy轴标题 p <- p + labs(title=geneN)+ theme(plot.title = element_text(hjust =0.5)) p <- p + theme(axis.text.x=element_text(hjust =1, angle =45)) p }