0

I am trying to link two-time series graphs into one graph in R, as a facet grid or anything interactive.

1st graph:

TT = ggplot(data = x1, aes(Date, Count_of_Fresh_emails)) + 
  geom_line(aes(color = Country), size = 1) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "darkgreen", "red")) +   
  theme_minimal() + 
  scale_x_date(date_labels = "%b/%Y")
ggplotly(TT)

2nd graph:

p <- ggplot(data = x2, aes(Date, FollowUp_Counts)) + 
  geom_line(aes(color = Country), size = 1) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "darkgreen", "red")) +  
  theme_minimal() + 
  scale_x_date(date_labels = "%b/%Y")
ggplotly(p)
Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • 2
    Have you tried to combine `x1` and `x2` into a single dataframe? – markus Apr 20 '19 at 10:28
  • You could use `bind_rows(x1, x2, .id = 'group')`, which is a function found in the dplyr package, then facet on the `group` variable. A reproducible example would allow us to assist with your specific problem.Or you could use `grid.arrange()` from the `gridExtra` package like this `grid.arrange(p, TT, nrow = 1)`. – Odysseus210 Apr 20 '19 at 11:50

0 Answers0