-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
I'm using stat summary to compute statistics directly in the graph and show a label for it, for example showing the 90% percentile.
The computed value is passed to the label aesthetic using after_stat
and that works fine when there are no axis transformations, but with a log10 transformation the label is in the right place but the text is after the transformation and but before the transformation.
From the documentation I would expect after_stat to be before any scale transformation.
Works fine with regular scale:
library(ggplot2)
ggplot(cars) +
geom_step(aes(x = speed), stat = "ecdf") +
geom_label(aes(x = speed, y = 0.9, label = after_stat(x)),
orientation = "y", stat = "summary", fun = quantile, fun.args = list(probs = 0.9))
Wrong text with log10 transformation:
library(ggplot2)
ggplot(cars) +
geom_step(aes(x = speed), stat = "ecdf") +
geom_label(aes(x = speed, y = 0.9, label = after_stat(x)),
orientation = "y", stat = "summary", fun = quantile, fun.args = list(probs = 0.9)) +
scale_x_log10()
Metadata
Metadata
Assignees
Labels
No labels