scales icon indicating copy to clipboard operation
scales copied to clipboard

`breaks_width()` does not work with reverse transform

Open teunbrand opened this issue 1 year ago • 0 comments
trafficstars

To reproduce:

library(scales)
demo_continuous(
  c(0, 10), 
  transform = "reverse", 
  breaks = breaks_width(1)
)
#> scale_x_continuous(transform = "reverse", breaks = breaks_width(1))
#> Error in seq.default(round_any(range[1], size, floor), round_any(range[2], : wrong sign in 'by' argument

Created on 2024-06-03 with reprex v2.1.0

I think fullseq() should sort the range before computing the breaks to fix the issue. Arguebly, user should use breaks = breaks_width(-1), but that sort of departs from the idea that break function input is specified in original space, not transformed space.

teunbrand avatar Jun 03 '24 09:06 teunbrand