The ggplot2 default looks nice. I can't see what function they use in the breaks argument as a default?? Thanks
library(tidyverse)
#> Warning: package 'purrr' was built under R version 4.3.1
#> Warning: package 'dplyr' was built under R version 4.3.1
library(nycflights13)
#> Warning: package 'nycflights13' was built under R version 4.3.1
d <- flights |>
mutate(date = ymd(paste(year, month, day))) |>
mutate(datetime = ymd_hm(paste(year, month, day, hour, minute))) |>
mutate(hourminute = hms::hms(hours = hour, minutes = minute)) |>
slice_head(n = 1000)
p <- d |>
ggplot() +
geom_point(aes(x = hourminute, y = arr_delay))
p
#> Warning: Removed 11 rows containing missing values or values outside the scale range
#> (`geom_point()`).
p +
scale_x_continuous(trans = "hms", breaks = scales::breaks_pretty())
#> Warning: Removed 11 rows containing missing values or values outside the scale range
#> (`geom_point()`).
Created on 2023-10-03 with reprex v2.0.2