strip.placement = "outside" and strip.switch.pad.wrap don't work together perfectly for facet_wrap.

Open
#5,935 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r

Research direction

Start by running the supplied ggplot2 examples with facet_wrap(), strip.placement, strip.position, and strip.switch.pad.wrap. Trace how facet_wrap lays out strips and padding for bottom, left, and right positions. Done means the padding is applied consistently to all panels for each shown strip position.

Written by the indexing model from the issue text.

Description

facets :gem: themes :dancer:

strip.switch.pad.wrap doesn't work when strip.placement = "outside" and strip.position = "bottom":

library(ggplot2)
base <- ggplot(mtcars, aes(mpg, drat)) +
  geom_point()

base + facet_wrap(~cyl) +
  theme(strip.placement = "outside",
        strip.switch.pad.wrap = unit(0.1,"npc"))

image

strip will only be added on one panel when strip.position = "bottom/left":

base + facet_wrap(~cyl,strip.position = "bottom",
                  ncol = 2) +
  theme(strip.placement = "outside",
        strip.switch.pad.wrap = unit(0.1,"npc"))

image

base + facet_wrap(~cyl,strip.position = "left") +
  theme(strip.placement = "outside",
        strip.switch.pad.wrap = unit(0.1,"npc"))

image

It doesn't work when strip.position = "right":

base + facet_wrap(~cyl,strip.position = "right") +
  theme(strip.placement = "outside",
        strip.switch.pad.wrap = unit(0.1,"npc"))

image

Dominant language
R
Stars
7k
Forks
2.1k
Avg merge
59m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tidyverse/ggplot2

All issues in tidyverse/ggplot2

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.