I'm drawing a geom_path()
and I'd like it to have arrows in the plot, but not have arrows in the legend. Googling around suggests that something of the form
guides(color=guide_legend(override.aes = list(..))
will have the answer, but I can't find documentation of what that list()
expects. The help file for guide_legend()
says to "look at the examples" to learn more about override.aes
but there is only one example showing how to set the alpha level in the legend.
To make what I'd like to do concrete, here's code that produces a plot with arrowheads,
data <- data.frame(x=c(1, 1, 1, 2),
y=c(1, 2, 1, 1),
color=c('color1', 'color1', 'color2', 'color2'))
library(ggplot2)
ggplot(data, aes(x=x, y=y, color=color, group=color)) +
geom_path(size=2,
arrow = arrow(angle = 30,
length = unit(0.1, "inches"),
ends = "last", type = "closed")) +
theme_bw()
But what I'm looking for is the legend with the not arrowhead version, as in
ggplot(data, aes(x=x, y=y, color=color, group=color)) +
geom_path(size=2) +
theme_bw()
Thank you!