Closed
Description
I demonstrate the problem here only for geom_hline
, but the same problem affects geom_vline
.
ggplot(data.frame(x = 0:5, y = 0:5), aes(x, y)) +
geom_point() +
annotate(geom = "hline",
yintercept = 2.5)
Adding an y
argument produces the expected output, with a warning:
Warning: Ignoring unknown aesthetics: y
ggplot(data.frame(x = 0:5, y = 0:5), aes(x, y)) +
geom_point() +
annotate(geom = "hline",
yintercept = 2.5, y = 2.5)
There is something odd going on: when y is present, the hline is plotted at the yintercept position, but the "ignored" unknown aesthetics still affects the scale limits.
ggplot(data.frame(x = 0:5, y = 0:5), aes(x, y)) +
geom_point() +
annotate(geom = "hline",
yintercept = 2.5, y = 100)
ggplot2 2.2.1.9000 installed minutes ago.
Hope this helps diagnose the problem.
Metadata
Metadata
Assignees
Labels
No labels