I had previously asked a question about plotting multiple lines in a linechart using ggplot2.
Here: Adding a second legend to line chart in ggplot2 in R
I am using the solution provided there to generate the chart, however I want to modify the title of the legend.
I tried the following:
tidyr::gather(m, foo, value, -bar) %>%
ggplot(aes(bar, value, colour = foo, linetype = foo)) +
geom_line() +
scale_color_discrete(name = "my awesome title")
and I get the following.
The above creates a separate legend called "my awesome title". I want a single legend where the title of the legend would be "my awesome title".
I have attempted the various solutions mentioned here: How to change legend title in ggplot but I cannot get this to work. Any help would be appreciated.