This function creates a ggplot2 continuous x-axis scale with breaks at the first day of each month, and labels corresponding to those dates. It is useful for time series plots where the x-axis represents months.

scale_x_month(...)

Arguments

...

Additional arguments passed to `ggplot2::scale_x_continuous`.

Value

A ggplot2 scale object for the x-axis.

Examples

data <- data.frame(
  date = seq(as.Date("2023-01-01"), as.Date("2023-12-31"), by = "day"),
  value = rnorm(365)
)
library(ggplot2)
ggplot(data, aes(x = date, y = value)) +
  geom_line() +
  scale_x_month()