Is there really no simple way to add a legend when using ggplot() to plot multiple lines? I understand that the "right" tidyverse method is to pretend the two lines are the same variable and then add a category...i.e. switch to long format.
library(magrittr)
library(tidyverse)
library(ggplot2)
set.seed(0)
n <- 10
v1 <- rnorm(n)
v2 <- v1 + rnorm(n)
theData <- tibble(v1=v1, v2 = v2)
theData %>% ggplot(aes(x=v1)) +
geom_line(aes(y=v2),color="red") +
geom_point(aes(y=v2),color="blue")
# Would be nice to get a legend showing red line and blue points
# even if it's a silly example
Created on 2022-05-02 by the reprex package (v2.0.1)