且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将geom_segment添加到ggplot中的geom_point图中

更新时间:2023-12-03 10:55:52

From ?geom_segment we see the requried aesthetics are x, xend, y, yend, so we can use

ggplot(data=mydf[mydf$groups==1,],aes(x=X,y=Y))+
  geom_point(size=2)+
  theme_bw() +
  geom_segment(aes(x=X, y=-Inf, xend=X, yend = Y))

相关阅读

推荐文章