geom_vline:xintercept(x轴截距) geom_abline:slope(斜率) 和intercept(截距) p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # 使用固定值 p1 <- p + geom_vline(xintercept = 5) # 使用向量 p2 <- p + geom_vline(xintercept = 1:5) # 水平线 p3 <- p + geom_hline(yintercept...
001、基础绘图 library(gcookbook) # For the datasetp<- ggplot(heightweight, aes(x = ageYear, y = heightIn, colour = sex)) +geom_point() p## 基础绘图 002、添加直线 p + geom_hline(yintercept =60) + geom_vline(xintercept =14)## 添加直线 003、调整颜色及粗细 p + geom_hline(yin...
p = ggplot(result,aes(x = log2FoldChange, y = -log10(padj)))+ geom_point(data = result,aes( x = log2FoldChange, y = -log10(padj),color = change))+ theme_bw()+ geom_vline(xintercept = c(-logFC,logFC),lty = 2)+ geom_hline(yintercept = c(-log10(adj_P)),lty = 2...
1、在ggplot的里面添加直线: geom_hline()添加水平线 geom_viline()添加垂直线 #geom_hline(yintercept=1.3,type=4)+geom_vline(xintercept=-1.1,type=4) #type=4是虚线 增加斜线: geom_abline(slope=1,intercept=0,color='red',size=2) #增加一个y=1*x+0的直线 slope设置斜率,intercept设置截距,co...
geom_vline() : 垂直线 geom_jitter() : 抖动点 geom_line() : 线图 geom_point() : 散点图 geom_rug() : 地毯图,??好奇 geom_smooth() : 拟合曲线 geom_text() : 文字注解 geom_violin() : 小提琴图 几何函数常见的参数,点、线颜色和类型等等。
geom_vline(xintercept=0,linetype ="dashed",size=0.2)+ geom_errorbarh(aes(xmin=`Lower confidence intervals`, xmax=`Upper confidence intervals`), position=position_dodge(0.8), height=0.2)+ geom_point(position=position_dodge(0.8), size=3, stroke =0.3, ...
geom_vline(xintercept = 3.5)+ geom_hline(yintercept = 20)+ coord_flip() #调整刻度范围#替换刻度值 ggplot(mtcars,aes(wt,mpg,color=factor(vs)))+ geom_point(shape=3,size=3)+ annotate("text",x=4,y=20,label="yes")+ labs(title="hello",x="sss",y="yyy")+ ...
ggplot(UG,aes(score,income),colour=sex)+geom_point()ggplot(UG,aes(score,income,colour=sex))+geom_point()ggplot(UG,aes(score,income))+geom_point(aes(colour=sex)) 第一种的点是黑色点,第二种和第三种都是按照性别这个变量分颜色,第三种比较好记忆,相当于先画好图,再加上带颜色的散点。
geom_vline(xintercept = 125,lty="dashed", color="red", size=1)+ geom_text(data=dftext,aes(x=x,y=y,label=label))+ coord_cartesian(clip = "off")+ annotation_custom(grob = linesGrob(gp=gpar(col="#e9d3ff", lwd=8, lineend="square")), ...
annotate(geom="rect",xmin=22,xmax=27,ymin=-Inf,ymax=Inf,fill="gray")+ geom_vline(xintercept=22,lty="dashed",size=1,color="black")+ geom_point(aes(color=group),size=3)+ geom_line(aes(color=group),size=1)+ scale_x_continuous(limits= c(10,27), ...