I have the following simple MWE. I want the green line in my legend to be a vertical line. Once I enable show.legend in geom_vline, it also adds a vertical line to every other line in the legend. Does anyone have a hint on how I can achieve this?
library(ggplot2)
ggplot(data = df) +
geom_line(aes(x = a, y = b, colour = "one", linetype = "one"), size = 2) +
geom_line(aes(x = a, y = c, colour = "two", linetype = "two"), size = 2) +
geom_vline(aes(xintercept = 0.5, colour = "three", linetype = "three"), alpha = 1, show.legend = F) +
scale_colour_manual("",
breaks = c("one", "two", "three"),
values = c("blue", "red", "green")) +
scale_linetype_manual("",
breaks = c("one", "two", "three"),
values = c("dashed", "solid", "solid")) +
theme_bw() +
theme(legend.key.size = unit(2, "cm"),
legend.position = c(0.05, 0.995), legend.justification = c(0.05, 0.995))