ggplot2
ggplot2 copied to clipboard
Sort scale and viewscale limits
This PR aims to fix #5918.
Briefly, continuous_scale()
now sorts the limits and position guides get passed sorted ranges.
The order of the limits should now only matter when choosing e.g. limits = c(NA, 10)
to substitute the NA
for the data limits. Examples below are from the issue.
Regular scale, flipped limits:
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
ggplot() + scale_x_continuous(limits = c(10, 0))
Reverse scale, sorted limits:
ggplot() + scale_x_reverse(limits = c(0, 10))
Created on 2024-05-31 with reprex v2.1.0