Skip to content

Update facet_wrap (adjsut the strip position for each panel when strip.placement is "outside") #5934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions R/facet-wrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ FacetWrap <- ggproto("FacetWrap", Facet,
inside_x <- (theme$strip.placement.x %||% theme$strip.placement %||% "inside") == "inside"
if (params$strip.position == "top") {
placement <- if (inside_x) -1 else -2
strip_pad <- axis_size$top
# strip_pad <- axis_size$top
strip_pad <- rep(strip_padding,ncol)
} else {
placement <- if (inside_x) 0 else 1
strip_pad <- axis_size$bottom
Expand All @@ -464,10 +465,12 @@ FacetWrap <- ggproto("FacetWrap", Facet,
inside_y <- (theme$strip.placement.y %||% theme$strip.placement %||% "inside") == "inside"
if (params$strip.position == "left") {
placement <- if (inside_y) -1 else -2
strip_pad <- axis_size$left
# strip_pad <- axis_size$left
strip_pad <- rep(strip_padding,ncol)
} else {
placement <- if (inside_y) 0 else 1
strip_pad <- axis_size$right
# strip_pad <- axis_size$right
strip_pad <- rep(strip_padding,ncol)
}
strip_pad[as.numeric(strip_pad) != 0] <- strip_padding
strip_width <- unit(apply(strip_mat, 2, max_width, value_only = TRUE), "cm")
Expand Down
Loading