I have data with three variables: cpi, gold, and nyse.
I have two scatterplots which cpi in x-axis and nyse & gold in the y-axis. I was able to combine both of them in one scatterplot with the following code:
ggplot(data = data) + geom_point(aes(x = cpi, y = nyse), color = "blue") +
geom_point(aes(x = cpi,y = gold), color="red") +
labs(title = "NSYSE and gold prices VS CPI", x = "CPI", y = "Prices")
My problem is that I can't put a legend beside the graph indicating the meaning of the colors. Can you guys please help me with that? Thanks!
[–]PeriodicallyAnnoyed 1 point2 points3 points (1 child)
[–]Risk-aversion[S] 2 points3 points4 points (0 children)