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

Using stage with non-scaled aesthetics #5408

Closed
thomasp85 opened this issue Sep 5, 2023 · 2 comments · Fixed by #5409
Closed

Using stage with non-scaled aesthetics #5408

thomasp85 opened this issue Sep 5, 2023 · 2 comments · Fixed by #5409

Comments

@thomasp85
Copy link
Member

Somewhat contrived example but able to solve real issues in gganimate:

data <- data.frame(test=1:3, x = 0, y = 0)
ggplot(data, aes(x=x, y=y)) +
    geom_text(aes(label=stage(test, after_scale = format(label, digits = 3))))
# Error in `geom_text()`:
# ! Problem while mapping stat to aesthetics.
# ℹ Error occurred in the 1st layer.
# Caused by error in `stage()`:
# ! object 'test' not found

This surprisingly happens while looking for a default scale for label in layer$map_statistic()

@teunbrand
Copy link
Collaborator

Appears to be that eval_tidy() is called on the staged expression at a point where the test column in the original data is no longer available. Would it be safe to skip adding default scales for staged expressions that do not have an after_stat argument?

@thomasp85
Copy link
Member Author

See #5409

add_default() is overly complicated

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