好像你的池 2 的标签是错误的,应该是 R1b 代替
如果您不想使用任何包,并且只有 2 行,您可以通过使用 plot(NULL...) 指定空白图来慢慢构建它,然后您将在 y=1 上放置一行,另一行在y=2 并根据这些坐标添加点、文本:
plot(NULL,xlim=c(10,35),ylim=c(0,3),xaxt="n",yaxt="n",
bty="n",xlab="",ylab="")
abline(h=1:2,col="#c0fefc")
points(x = df1[,"Start Pool 1"], y = rep(2,nrow(df1)),
pch=20,cex=2,col="#77acf1")
text(x = df1[,"Start Pool 1"], y = rep(2.5,nrow(df1)),
labels = df1[,"Pool 1"])
points(x = df1[,"Start Pool 2"], y = rep(1,nrow(df1)),
pch=20,cex=2,col="#77acf1")
text(x = df1[,"Start Pool 2"], y = rep(1.5,nrow(df1)),
labels = df1[,"Pool 2"])
axis(side=2,at=1:2,labels=c("Pool2","Pool1"),las=2,col=NA,col.ticks = 1)
其他使用ggplot2:
df = data.frame(
label = c(df1[,"Pool 1"],df1[,"Pool 2"]),
value = c(df1[,"Start Pool 1"],df1[,"Start Pool 2"]),
pool = rep(c("Pool1","Pool2"),each=nrow(df1))
)
ggplot(df,aes(x=value,y=pool,label=label)) +
geom_point(size=4,col="#77acf1") +
geom_text(nudge_y=0.2) +
theme_minimal() +
xlab("") + ylab("") +
theme(panel.grid.major.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text.x = element_blank())