dd <- data.frame(
  date = seq(date_yq(2012, 4), date_yq(2018, 4)),
  V1 = 1:25
)

ggplot(
  dd,
  aes(
    x = date,
    y = V1
  )
) + 
  geom_point() +
  scale_x_date_yq(breaks = date_yq_breaks(3)) 

ggplot(
  dd[get_year(dd$date) %in% 2014, ],
  aes(
    x = date,
    y = V1
  )
) + 
  geom_point() +
  scale_x_date_yq()

scale arguments

  p <- ggplot(
    dd,
    aes(
      x = date,
      y = V1
    )
  ) + 
    geom_point() 
  
  p + scale_x_date_yq(labels = waiver()) + ggtitle("auto Labels")

  p + scale_x_date_yq(labels = NULL) + ggtitle("no Labels")

  p + scale_x_date_yq(breaks = date_yq(2016, 2:3), labels = LETTERS[1:2] ) + ggtitle("manual Labels")

  p + scale_x_date_yq(labels = format_yq_iso) + ggtitle("function Labels")

  p + scale_x_date_yq(breaks = waiver()) + ggtitle("auto breaks")

  p + scale_x_date_yq(breaks = NULL) + ggtitle("no breaks")

  p + scale_x_date_yq(breaks = date_yq(2016, 2:3) ) + ggtitle("manual breaks")

  p + scale_x_date_yq(breaks = date_yq_breaks(4) ) + ggtitle("function breaks")

date_ym

dd <- data.frame(
  date = seq(date_ym(1950, 1), date_ym(2018, 11)),
  V1 = 1
)

ggplot(
  dd,
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_ym()

ggplot(
  dd[600:700, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_ym()

ggplot(dd[1:3, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_ym()

ggplot(dd[1:12, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_ym(breaks = date_ym_breaks(12))

ggplot(dd[1:22, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_ym(breaks = date_ym_breaks())

date_ym_breaks()(dd[1:3, ]$date)
## [1] "1950-M01" "1950-M02" "1950-M03"

date_ym

dd <- data.frame(
  date = seq(date_yw(1950, 1), date_yw(2018, 11)),
  V1 = 1
)

ggplot(
  dd,
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw()

ggplot(
  dd[600:700, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw()

ggplot(dd[1:3, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw()

ggplot(dd[1:12, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw(breaks = date_yw_breaks(12))

ggplot(dd[1:22, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw(breaks = date_yw_breaks())

ggplot(dd[1:53, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw(breaks = date_yw_breaks())

ggplot(dd[1:93, ],
  aes(
    x = date,
    y = V1
  )
) +
  geom_point() +
  scale_x_date_yw(breaks = date_yw_breaks())

date_yw_breaks()(dd[1:3, ]$date)
## [1] "1950-W01" "1950-W02" "1950-W03"