https://www.zhihu.com/question/430557474
plot() + scale_x_discrete(expand = c(0,1))
plot() + scale_y_discrete(expand = c(0,1))
1. 示例
ggplot()+geom_violin(data=kk_1, aes(x=seurat_clusters, y=nCount_RNA, fill=seurat_clusters))+scale_y_log10()+theme_cowplot()+NoLegend()+
scale_x_discrete(limits=as.factor(c(1,2,7,5,8,3,4,9,0,6,10)), expand = c(0,1)) '#示例一
ggplot()+geom_violin(data=kk_1, aes(x=seurat_clusters, y=nCount_RNA, fill=seurat_clusters))+scale_y_log10()+theme_cowplot()+NoLegend()+
scale_x_discrete(limits=as.factor(c(1,2,7,5,8,3,4,9,0,6,10)), expand = c(0.9,1)) #示例二
![](https://img.haomeiwen.com/i23414774/566f7f08f4c8bcdb.png)
![](https://img.haomeiwen.com/i23414774/e5b4dcb819eccdd9.png)
网友评论