already searched all related threads about this but could not find a solution.
Here is my code and the attached plot result:
g <-ggplot(NDVI2, aes
override.aes
is definitely a good start for customizing the legend. In your case you may remove unwanted shape
in the legend by setting them to NA
, and set unwanted linetype
to blank
:
ggplot(data = NDVI2, aes(x = LAI2, y = NDVI, colour = Legend)) +
geom_point(size = 3) +
geom_smooth(aes(group = 1, colour = "Trendline"),
method = "loess", se = FALSE, linetype = "dashed") +
geom_smooth(aes(group = 1, colour = "Regression (log)"),
method = "lm", formula = y ~ log(x), se = FALSE, linetype = "solid") +
scale_colour_manual(values = c("purple", "green", "blue", "yellow", "magenta","orange", "cyan", "red", "black"),
guide = guide_legend(override.aes = list(
linetype = c(rep("blank", 7), "solid", "dashed"),
shape = c(rep(16, 7), NA, NA))))