0

I have 2 separate ggplots with the same dates (came from the same file) and I need to show both lines on the same graph

Here is my code:

oilP = data %>%
     ggplot(aes(x = date, y = oil)) +
     geom_line(color = "green") +
     ylab("price")

coalP = data %>%
  ggplot(aes(x = date, y = coal)) +
  geom_line(color = "red") +
  ylab("price")

Any ideas?

I tried ggarrange, but that just gives the plots side by side

  • This question gets asked a lot on Stack Overflow (I believe this is the third time today). I am going to close as a duplicate. If you get stuck applying this to your own data, please come back and let us know. – Allan Cameron Nov 10 '22 at 23:47

0 Answers0