problem with facet_grid with date variable

I am facet_grid()ing date variable on x axis by years ~ months, but it shrinks the plot where months overlap (see the image):

This is the code that generates this plot:

gwp %>% 
  ggplot(aes(x = date, y = tbilisi, colour = tbilisi)) +
  geom_point(colour = "red", na.rm = TRUE) +
  geom_line(size = 0.6, show.legend = FALSE, alpha = 0.7, na.rm = TRUE) +
  geom_hline(yintercept = 19.4, size = 0.8, alpha = 0.9) +
  scale_colour_gradient2(low = "grey50", high = "black", midpoint = 19.4) +
  scale_x_date(breaks = "months", date_labels = "%b (%y)") +
  scale_y_continuous(limits = c(5,30)) +
  facet_grid(year(date) ~ month(date), scales = "free_x") +
  labs(x = " ") +
  theme_clean() +
  theme(axis.line.x = element_blank(),
        axis.line.y = element_blank(),
        axis.ticks.x = element_blank(),
        legend.position = "none",
        text = element_text(size = 30))

Where 'gwp' is a data frame and 'Tbilisi' is a continuous variable.

I just want to understand what is the underlying problem that doesn't plot x axis for all the months properly.

If you have any suggestions, please!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.