Skip to content

Using position_stack() with text geom in stat_summary(), round 2 #4367

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

Closed
krassowski opened this issue Mar 8, 2021 · 1 comment · Fixed by #4692
Closed

Using position_stack() with text geom in stat_summary(), round 2 #4367

krassowski opened this issue Mar 8, 2021 · 1 comment · Fixed by #4692
Labels
bug an unexpected problem or unintended behavior positions 🥇

Comments

@krassowski
Copy link
Contributor

Follow up after #2709, reusing the code from there; while #3416 which closed #2709 solved a part of the issue (release in 3.3.0), it still does not work in 3.3.3, but a different error is shown this time.

Someone else also encountered this behaviour 9 months ago and posted this question on SO.

library(ggplot2)

# Using stat_summary for aggregation
ggplot(mtcars, aes(x = factor(cyl), y = mpg, fill = factor(am))) + 
    stat_summary_bin(fun.y = sum, geom="bar", position = "stack")+
    stat_summary(aes(label = stat(y)), fun.y = sum,  geom = "text", 
                 position = position_stack(vjust = .5))
#> Error: Discrete value supplied to continuous scale
@yutannihilation
Copy link
Member

Thanks, confirmed. #3416 assumes NA_real_, but it seems it's a logical value NA in actual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior positions 🥇
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants