You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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/
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/
lockbot
locked and limited conversation to collaborators
May 20, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bugan unexpected problem or unintended behaviorscales 🐍
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:
The issue is that the default implementation of
Scale$get_limits()
refers toself$trans
, which isn't defined for discrete scales. One way to fix this is to move the default implementation toScaleContinuous
and move the implementation inScaleDiscretePosition
that was added in #3426 toScaleDiscrete
.The text was updated successfully, but these errors were encountered: