scales
scales copied to clipboard
Allow custom date order in label_date_short()
trafficstars
Under the current build, the long labels must render as %b-%Y.
However, it would be good to specify that the long labels should go %Y-%b.
For example
# Data
df_test <-
tibble(
date = seq(as.Date("2010-1-1"), as.Date("2012-1-1"), by = "months"),
value = rnorm(n = length(date), mean = 10, sd = 1))
# Graph
df_test %>%
ggplot(aes(x = date, y = value)) +
geom_line() +
scale_x_date(date_breaks = "1 month",
labels = scales::label_date_short(format = c("%Y", "%b"))) +
theme(axis.text.x = element_text(angle = 0, hjust = 1))
This produces the graph

See that the long labels render %b-%Y. It would be good to specify that the long labels should go %Y-%b too.