我正在使用“beeswarm”包,并想在我的观点后面绘制一个 abline。下面的代码将在我的点上绘制线。
library(beeswarm)
testdf<-data.frame(a=c(1,1,1,2,2,2,3,3,3),b=c(1,2,3,1,4,6,1,3,4))
beeswarm(b ~ a,data=testdf,col="red",bg="red",pch=21)
abline(3,0)
我知道这个问题已经回答了仅使用基础 R 的绘图(例如这里:How do I draw gridlines using abline() that are behind the data?),但是当应用于我的数据时,这些解决方案只创建两个带有一个abline 和一个与 beeswarm 情节。
在此先感谢您的帮助!