I'm trying to manipulate my legend in ggplot
.
My data looks like this: data
Using ggplot
I plotted "time" on x axis and both "C16.conc." and "C18.conc" on y axis.
ggplot(df, aes(x=Time)) +
geom_point(aes(y=C16.conc), size=3, shape = 16, color="red") +
geom_smooth(aes(y=C16.conc), method = "lm", color= "red", linetype = "dashed", lwd=.8, se = FALSE) +
geom_point(aes(y=C18.conc), size=3, shape = 16, color="black") +
geom_smooth(aes(y=C18.conc), method = "lm", color= "black", linetype = "dashed", lwd=.8, se = FALSE)
I can't figure out how to add a legend for this plot, the only command I know is to use
aes(fill=column name)
but since I'm plotting data from two separate columns (C16.conc and C18.conc) I can't get the aes command above to make a legend. How should I add a legend with this data frame?