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

Funcational limits on non-position discrete scales refer to non-existent field trans #3448

Closed
paleolimbot opened this issue Jul 22, 2019 · 2 comments
Labels
bug an unexpected problem or unintended behavior scales 🐍

Comments

@paleolimbot
Copy link
Member

paleolimbot commented Jul 22, 2019

Thanks to #3426 we can now use functional limits on discrete position scales. However, when using them on non-position discrete scales, there is an error:

library(ggplot2)
ggplot(mpg, aes(displ, hwy, col = class)) +
  geom_point() +
  scale_colour_discrete(limits = rev)
#> Error in self$trans$transform(self$limits(self$trans$inverse(self$range$range))): attempt to apply non-function

The issue is that the default implementation of Scale$get_limits() refers to self$trans, which isn't defined for discrete scales. One way to fix this is to move the default implementation to ScaleContinuous and move the implementation in ScaleDiscretePosition that was added in #3426 to ScaleDiscrete.

@paleolimbot paleolimbot added bug an unexpected problem or unintended behavior scales 🐍 labels Jul 22, 2019
@lock
Copy link

lock bot commented May 20, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

1 similar comment
@lock
Copy link

lock bot commented May 20, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior scales 🐍
Projects
None yet
Development

No branches or pull requests

1 participant