Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addstrip.spacing theme element#5958

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
teunbrand wants to merge6 commits intotidyverse:main
base:main
Choose a base branch
Loading
fromteunbrand:strip_spacing

Conversation

teunbrand
Copy link
Collaborator

@teunbrandteunbrand commentedJun 27, 2024
edited
Loading

This PR aims tofix#5935.

Briefly, a new theme elementstrip.spacing is used to set the distance from the panel to the strip unconditionally.

Previously, we could only usestrip.switch.pad.{grid/wrap} to set this distance, but only if there was an axis in between the panel and the strip. In case the conditions for thestrip.switch.pad.{grid/wrap} are met, thenstrip.spacing is additive to that spacing. The default spacing isrel(0) inheriting from the roottheme(spacing) argument, so it doesn't add space by default.

However, it does add a gtable cell even when there is 0-spacing, which helps towards#5628 as the gtable shape no longer depends on the relative placement of axes and strips (the cell is added regardless).

To give a few examples. We weren't able to do this before:

devtools::load_all("~/packages/ggplot2")#> ℹ Loading ggplot2p<- ggplot(mpg, aes(displ,hwy))+  geom_point()p+ facet_wrap(year~drv)+  theme(strip.spacing= unit(1,"cm"))

Or this:

p+ facet_grid(year~drv,switch="both")+  theme(strip.spacing= unit(1,"cm"))

Created on 2024-06-27 withreprex v2.1.0

@thomasp85
Copy link
Member

I am pretty sure this might have consequences for patchwork. Can I get you to look into this before we move forward?

@teunbrand
Copy link
CollaboratorAuthor

teunbrand commentedAug 20, 2024
edited
Loading

Hmm you're right that this doesn't work with patchwork. The PR essentially uses the same gtable cells as thestrip.switch.{wrap/grid}.pad setting. I had thought that patchwork was able to deal with this andstrip.position = "outside" but it does not (seethomasp85/patchwork#361). Let's press the pause buttom on this PR for now until patchwork has fielded a solution for this.

@teunbrandteunbrand marked this pull request as draftAugust 20, 2024 12:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

strip.placement = "outside" and strip.switch.pad.wrap don't work together perfectly for facet_wrap.
2 participants
@teunbrand@thomasp85

[8]ページ先頭

©2009-2025 Movatter.jp