Skip to content
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

Restore rather than recalculate scales in FacetWrap with CoordFlip #6130

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

mikmart
Copy link
Contributor

@mikmart mikmart commented Oct 4, 2024

Currently FacetWrap$draw_panels() recalculates layout$SCALE_X and layout$SCALE_Y if used with coord_flip(). This PR changes the behaviour to instead restore the scales as calculated by $compute_layout().

This is relevant when a subclass of FacetWrap has a customised layout, but could still otherwise call FacetWrap$draw_panels(), like in ggragged.

Fixes mikmart/ggragged#2.

Copy link
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this simplification, I've always hated the finnickyness of facet_wrap/coord_flip interaction. I'll approve this but will wait a few days before merging so that it can appear on Thomas' radar.

@teunbrand teunbrand merged commit ad97679 into tidyverse:main Oct 7, 2024
13 checks passed
@teunbrand
Copy link
Collaborator

Thank you for the contribution!

@mikmart
Copy link
Contributor Author

mikmart commented Oct 7, 2024

Thanks!

@mikmart mikmart deleted the wrap-flip branch October 7, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X-axis scale issue when using "free_x" with facet_ragged_cols()
2 participants