Add a segment only to one facet using ggplot2

為{幸葍}努か 提交于 2019-11-30 23:05:36

Put the data for the segment in data frame and also add columns FactorB and FactorC with levels for which you need to draw the segment.

data.segm<-data.frame(x=0.8,y=100,xend=1.2,yend=100,
                      FactorB="Condition1",FactorC="Condition1")

Now use this data frame to add segment. Also add inherit.aes=FALSE inside geom_segment() to ignore fill=FactorA set in ggplot().

  + geom_segment(data=data.segm,
               aes(x=x,y=y,yend=yend,xend=xend),inherit.aes=FALSE)+

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!