I want to combine three data frames with different row numbers and same column names into the same plot. Below is the code I am using based on another stack overflow question >ggplot combining two plots from different data.frames<
df1 <- data.frame(dist=c(5,10,15,25,30,40,45,50), #8
r2=c(105,90,70,50,40,15,17,8))
df2 <- data.frame(dist=c(5,10,15,25,30,40,45,50,55,60),#10
r2=c(100,80,60,40,30,25,15,10,5,3))
df3 <- data.frame(dist=c(3,5,10,15,20,25,30,35,40,45,50,60),#12
r2=c(110,100,80,60,50,35,30,25,20,15,10,5))
ggplot() +
theme_bw() +
geom_line(data = df1, aes(x = dist, y = r2), color = "red") +
geom_line(data = df2, aes(x = dist, y = r2), color = "blue")+
geom_line(data = df3, aes(x = dist, y = r2), color = "orange")
However, in those answers, there is not information about adding legends, title or adjusting axis.
Any advice to include information from those three data frames into the plot is highly appreciated.