Skip to content

Using stage with non-scaled aesthetics #5408

@thomasp85

Description

@thomasp85

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions