Skip to content

Calculate stat_align() per panel #5239

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

Merged
merged 4 commits into from
Mar 23, 2023
Merged

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5227 and fix #5176, thereby superseding #5177.

Briefly, to prevent the small offset adjust taking on too large values, we calculate the unique x-locations ± offset per panel instead of globally. I think it comes with the following trade-offs.

  • - It has to be computed for every panel, possibly being less efficient than doing it once globally.
  • + To compensate, I tried making determining the unique x-positions faster, by
    • Not taking into account 0-crossings when there is only one group and no stacking needs to occur
    • Unlooping the groupwise 0-crossings calculation for efficiency

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

Can you add a unit test that covers what this fixes?

@teunbrand teunbrand merged commit 5f2011f into tidyverse:main Mar 23, 2023
@teunbrand teunbrand deleted the stat_align_panel branch March 23, 2023 18:01
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.

geom_area does not align with geom_line with duplicate x coords geom_area() producing weird areas for some input values
2 participants