Distancing `facet_grid` strips from the faceted canvas?

后端 未结 2 1402
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-21 10:13

Consider the following example from the ?ggplot2::facet_grid:

p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(vars(drv), vars(cyl         


        
2条回答
  •  自闭症患者
    2021-01-21 10:46

    Following up on @Tung's anser above (and some documentation-ignoring experimentation), I get it to work:

    p <- ggplot(mpg, aes(displ, cty)) + geom_point() 
    p +
      facet_grid(vars(drv), vars(cyl)) +
      theme(strip.switch.pad.grid = unit(0.2, "cm"), strip.placement = "outside")
    

    And ... tada!:

提交回复
热议问题