library(ggplot2)
library(dplyr)
df <- tibble(
date = seq.Date(as.Date("2020-01-01"), as.Date("2025-01-01"), by = "month"),
value = rnorm(61)
)
ggplot(df, aes(date, value)) +
geom_line() +
scale_x_date(breaks = date_breaks_n(df$date, 6))
Run the code above in your browser using DataLab