I have the following graph.
ggplot() +
geom_hline(aes(yintercept = 0, linetype = "Line 1"), color = "white", size = 1.25) +
geom_hline(aes(yintercept = 0, linetype = "Line 2"), color = "white", size = 1.25) +
scale_linetype_manual(name = "Reference Lines", values = rep("dashed", 2), guide = guide_legend(override.aes = list(color = c("red", "green")))) +
theme_void()
How can I center the legend in the plot area? I made the actual graph completely white because I'm just interested in the legend in this case.
theme(legend.position = "inside", legend.position.inside = c(0.5, 0.5))
to your code? I'm assuming by "center", you would like the legend to be both vertically and horizontally centered inside the plot area.