I'd like to make a graph of panel data. I included the paneldata with a dput(). The issue I'm running into is as follows. I'd like each single date be displayed on the x-axis with a ggplot instead of estimates as it regularly does. Hence I use:
ggplot(data = industry_risk_exposure_covid, aes(x=Quarter, y=Risk_exposure)) +
geom_line(aes(colour=industry)) +
scale_x_continuous(labels = as.character(Quarter), breaks=Quarter) +
However obviously it runs into problems with the x-axis as the x-axis is panel data hence repeating its values. How do I solve this problem?
structure(list(Quarter = c(2019.3, 2019.4, 2020.1, 2020.2, 2020.3,
2020.4, 2021.1, 2019.3, 2019.4, 2020.1, 2020.2, 2020.3, 2020.4,
2021.1, 2019.3, 2019.4, 2020.1, 2020.2, 2020.3, 2020.4, 2021.1
), Risk_exposure = c(0.931366310178586, 0.790048218420605, 0.926209779967134,
0.948074080058149, 0.977557012231547, 0.798212439797712, 1.37986128229538,
0.643837908999298, 0.589151809903988, 0.560347370890284, 0.610139698052225,
0.594840529383872, 0.625698251450734, 0.647346199698159, 0.672295261900964,
0.661018891645603, 1.12339028625562, 0.882948576808631, 0.706404636299307,
0.929349206317779, 0.574016070848228), industry = c("Retail",
"Retail", "Retail", "Retail", "Retail", "Retail", "Retail", "Consumer services",
"Consumer services", "Consumer services", "Consumer services",
"Consumer services", "Consumer services", "Consumer services",
"Food beverage Tabacco", "Food beverage Tabacco", "Food beverage Tabacco",
"Food beverage Tabacco", "Food beverage Tabacco", "Food beverage Tabacco",
"Food beverage Tabacco")), class = "data.frame", row.names = c(NA,
-21L))