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

scale_{x,y}_continuous() functions do not work inside do.call() #5687

Closed
schloerke opened this issue Feb 9, 2024 · 2 comments
Closed

scale_{x,y}_continuous() functions do not work inside do.call() #5687

schloerke opened this issue Feb 9, 2024 · 2 comments

Comments

@schloerke
Copy link
Contributor

schloerke commented Feb 9, 2024

I found a problem with... scale_y_continuous() (and by extension scale_x_continuous()) not working when called inside a function executed by do.call().

I expected... the execution location to not have effect on the method.

Here is the code to reproduce the bug:

library(ggplot2)

plot_fn <- function(data = iris, mapping = aes(Sepal.Length, Sepal.Width)) {
  ggplot(data, mapping) + geom_point() + scale_y_continuous()
}

do.call(plot_fn, list())
#> Error in as.character(call[[1]]): cannot coerce type 'closure' to vector of type 'character'

Created on 2024-02-09 with reprex v2.0.2

ggplot2 * 3.4.4.9000 2024-02-08 [1] Github (tidyverse/ggplot2@a4be39d)


Related: #5443, #5436

cc @teunbrand


Work around: Use rlang::inject(plot_fn(!!!args)); (... But I should not be required to do this)

@schloerke schloerke changed the title scale_*_continuous() functions do not work inside do.call() scale_{x,y}_continuous() functions do not work inside do.call() Feb 9, 2024
schloerke added a commit to ggobi/ggally that referenced this issue Feb 9, 2024
@teunbrand
Copy link
Collaborator

Have you tried using the release candidate? It seems like a familiar issue that I might've fixed already. You can install it using:

remotes::install_github("tidyverse/ggplot2", ref = remotes::github_pull("5592"))

@schloerke
Copy link
Contributor Author

I can not reprex with latest RC branch. Closing

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

No branches or pull requests

2 participants