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

Feature request: rescale.AsIs method #403

Closed
teunbrand opened this issue Oct 31, 2023 · 2 comments · Fixed by #404
Closed

Feature request: rescale.AsIs method #403

teunbrand opened this issue Oct 31, 2023 · 2 comments · Fixed by #404

Comments

@teunbrand
Copy link
Contributor

In ggplot2 we're considering to let AsIs vectors be unresponsive to scales in tidyverse/ggplot2#5477.
What would work really well for that PR, is if {scales} would define a recale method for AsIs objects that returns input unaltered.

My proposal is simply the following:

rescale.AsIs <- function(x, to, from, ...) {
  x
}

Currently, no such method exists, so we're unlikely to be harming any existing code out there:

scales::rescale(I(1:3))
#> Error in UseMethod("rescale"): no applicable method for 'rescale' applied to an object of class "AsIs"

Created on 2023-10-31 with reprex v2.0.2

@thomasp85
Copy link
Member

Sounds good to me. Would you like to create a PR?

@teunbrand
Copy link
Contributor Author

Yes, I'll prepare one later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants