I have this graph:(Real GDP cycle of Ecuador)
This is the code that had built it:
df %>%
filter(Serie %in% "GDP Cycle") %>%
ggplot() +
aes(x = quarters, y = Valor) +
geom_line(size = 1L, colour = "#cb181d") +
labs(x = "Trimestres", y = "% Standard Deviation from Trend", title = "Ciclo del PIB Real del Ecuador", subtitle = "Corte trimestral, Año Base 2007", caption = "Banco Central del Ecuador") +
theme_light()+ theme(plot.title = element_text(face = "bold", size = 15))+ theme(plot.subtitle = element_text(size = 10))+
geom_hline(yintercept = 0,linetype="dashed", size=1)
How can I get that in the X axis show me the labels of each quarter like this:
2000.q1, 2000.q2, . . ., 2020.q1, 2020.q2, 2020.q3
This is an example of the data:
df %>%
+ filter(Serie %in% "GDP Cycle")
# A tibble: 83 x 4
counter quarters Serie Valor
<dbl> <dttm> <chr> <dbl>
1 1 2000-01-01 00:00:00 GDP Cycle -0.00973
2 2 2000-04-01 00:00:00 GDP Cycle -0.000653
3 3 2000-07-01 00:00:00 GDP Cycle 0.0125
4 4 2000-10-01 00:00:00 GDP Cycle 0.0195
5 5 2001-01-01 00:00:00 GDP Cycle 0.00608
6 6 2001-04-01 00:00:00 GDP Cycle 0.00562
7 7 2001-07-01 00:00:00 GDP Cycle -0.00471
8 8 2001-10-01 00:00:00 GDP Cycle -0.00357
9 9 2002-01-01 00:00:00 GDP Cycle -0.00137
10 10 2002-04-01 00:00:00 GDP Cycle 0.00144
# … with 73 more rows
How can I make to get the labels on x axis in this format: "Jan 2000" to "Jul 2020"?