Skip to content

Inconsistent behavior of strip.switch.pad.grid and strip.switch.pad.wrap in ggplot 3.3.3 #4610

Closed
@KleinWurm

Description

@KleinWurm

According to ?theme, strip.switch.pad.grid and strip.switch.pad.wrap have the same effect, i.e. "space between strips and axes when strips are switched (unit)". My intuitive understanding was to use strip.switch.pad.wrap with facet_wrap and strip.switch.pad.grid with facet_frid. However this is wrong according to the reprex below:

    library(ggplot2)
    p <- ggplot(data = iris, aes(x = Sepal.Length, y = Petal.Length)) + theme(strip.placement = "outside")
    p + facet_wrap(.~Species) + theme(strip.switch.pad.wrap = unit(10, "mm"))

    p + facet_wrap(.~Species) + theme(strip.switch.pad.grid = unit(10, "mm"))

    p + facet_grid(.~Species) + theme(strip.switch.pad.grid = unit(10, "mm"))

    p + facet_grid(.~Species) + theme(strip.switch.pad.wrap = unit(10, "mm"))

Session info:

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

ggplot2 version 3.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorfacets 💎

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions