Skip to content

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

Closed
@krassowski

Description

@krassowski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorpositions 🥇

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions