-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix bug in guide_axis_logticks(negative.small)
#6126
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
base: main
Are you sure you want to change the base?
Conversation
R/guide-axis-logticks.R
Outdated
tens <- tens[tens >= small] | ||
tens <- c(tens, -tens, 0) | ||
fives <- fives[fives >= params$negative_small] | ||
fives <- fives[fives >= small] | ||
fives <- c(fives, -fives) | ||
ones <- ones[ones >= params$negative_small] | ||
ones <- ones[ones >= small] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something unnerving about defining a variable in one if block (small
), and then using it in another, even though the blocks have the same condition.
To be clear, it is perfectly valid, but I think it is a brittle structure
Let's wait on {scales} to release a new version so we can use r-lib/scales#452 for this |
Merge branch 'main' into fix_pseudo_log_ticks # Conflicts: # tests/testthat/test-guides.R
This PR aims to fix #6121.
Briefly, is ensures that the limits it uses to calculate log-breaks are sorted.
Moreover, it picks a better default value for
negative.small
when the scale maximum is small.Some examples based on the issue's regex; first showing that it now doesn't error and doesn't render absurd tick marks:
Second, showing the plot with a reasonable
negative.small
argument for this plot:Lastly, showing the plot with an inappropriate
negative.small
argument (which still doesn't throw an error).Created on 2024-09-30 with reprex v2.1.1