https://juejin.cn/post/7128265519047639077
添加非線性回歸線
1. 使用
ggplot(kk, aes(x=Pseudotime, y=nFeature_RNA))+geom_point()+geom_smooth(size=3, color="red", level=0.95, fill="blue")+scale_y_log10()
size=
: 回歸線的寬度
color=
: 回歸線的顏色
level=
: 置信區(qū)間的大小残拐,默認(rèn)為 95%
fill=
: 置信區(qū)間的顏色
2. 數(shù)據(jù)提取
pp <- ggplot(kk, aes(x=Pseudotime, y=nFeature_RNA))+geom_point()+geom_smooth()+scale_y_log10()
ff <- ggplot_build(pp)
3. 示例一
ggplot(kk, aes(x=Pseudotime, y=nFeature_RNA))+geom_point()+
geom_smooth(size=3, color="red", level=0.95, fill="blue")+scale_y_log10()+theme_cowplot() '#示例一
示例一