annotation_custom with npc coordinates in ggplot2

后端 未结 1 584
南笙
南笙 2021-01-20 00:59

I would like to draw a box at the bottom of each panel, where each panel may have different y-ranges. The box should always be from 3 to 7 on the x-axis and from t

相关标签:
1条回答
  • 2021-01-20 01:47

    You could do,

    g <- rectGrob(y=0,height = unit(0.05, "npc"), vjust=0, 
                  gp=gpar(fill="black"))
    p + annotation_custom(g, xmin=3, xmax=7, ymin=-Inf, ymax=Inf)
    

    0 讨论(0)
提交回复
热议问题