0

Goal: To display four different line charts (each with their own unique dataset) as one composite image, preferably with titles on each too.

Tried: I've tried assigning the graphs as four different variables and faceting them that way, but everywhere I look only shows guides on how to Facet from the same data set.

Code for the 4 graphs to be faceted:

# OWID Covid Data
p1 <- ggplot(line_chart_owid_covid_data, aes(x=Date, y=Total_Cases_Per_Million, group = 1))+geom_line(color = "red", size = 2)+
  labs(x="Date", y="Total Cases Per Million",
       title="UK Covid Cases Per Million 31/01/2020-18/11/2021",
       caption="OWID Covid Data Set") + theme_ipsum() + 
  theme(axis.text.x = element_text(angle=45, vjust = 0.5),
        legend.title=element_blank(),
        legend.position = c(.4,0.85))

# ONS Unemployment Data
p2 <- ggplot(line_chart_unemployment_data, aes(x=Date, y=Unemployment_Rate, group = 1))+geom_line(color = "red", size = 2)+
  labs(x="Date", y="Unemployment Rate",
       title="Unemployment Rate January 2020-August 2021 ",
       caption="ONS Unemployment Data") + theme_ipsum() + 
  theme(axis.text.x = element_text(angle=45, vjust = 0.5),
        legend.title=element_blank(),
        legend.position = c(.4,0.85))

# Quarterly Suicide Data
p3 <- ggplot(line_chart_quarterly_suicide_data, aes(x=Date, y=Total_Registered_Deaths, group = 1))+geom_line(color = "red", size = 2)+
  labs(x="Date", y="Total Registered Deaths",
       title="Total Registered Suicide Deaths 01/01/2019-31/06/2021",
       caption="GOV UK Data")+ theme_ipsum() + 
  theme(axis.text.x = element_text(angle=45, vjust = 0.5),
        legend.title=element_blank(),
        legend.position = c(.4,0.85)) 

# Universal Credit Data
p4 <- ggplot(line_chart_universal_credit_data, aes(x=Date, y=People_on_Universal_Credit, group = 1))+geom_line(color = "red", size = 2)+
  labs(x="Date", y="No. of People on Universal Credit",
       title="Number of People on Universal Credit Janurary 2020-October 2021",
       caption="GOV UK Data")+ theme_ipsum() + 
  theme(axis.text.x = element_text(angle=45, vjust = 0.5),
        legend.title=element_blank(),
        legend.position = c(.4,0.85))
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294

1 Answers1

0

cowplot::plot_grid wilkelab.org/cowplot/articles/introduction.html