Skip to content

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

Closed

Description

@paleolimbot

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.

Activity

  1. added
    bug
    on Jul 22, 2019
  2. lock commented on May 20, 2020

    @lock

    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/

  3. lock commented on May 20, 2020

    @lock

    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/

  4. locked and limited conversation to collaborators on May 20, 2020
  5. added a commit that references this issue on Aug 14, 2024
    86cc4d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscales 🐍

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions