I have a problem where the legend of my ggplot()
does not appear. Here\'s my code:
plot_bt <- ggplot(NULL, aes(x, v1)) +
geom_line(data = nig_
Just do this:
plot_bt <- ggplot(NULL, aes(x, v1)) +
geom_line(data = nig_bt_1, aes(colour = "a")) +
geom_line(data = nig_bt_2, aes(colour = "b")) +
geom_line(data = nig_bt_3, aes(colour = "c")) +
labs(x = "X", y = "Probability") +
scales_color_manual(values= c("a" = "black", "b" = "blue", "c" = "red"))
A guide can only depict mappings you've defined using aes
. The ggplot2 way is of course to first combine the data and use a grouping variable.