Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Using date breaks/minor breaks/labels in time scales. #6282

Merged
merged 13 commits into from
Jan 28, 2025
Prev Previous commit
Next Next commit
work in a skip
teunbrand committed Jan 13, 2025
commit cf68b7665c25cdfa9fb39902c7d21b80f1a8776d
1 change: 1 addition & 0 deletions tests/testthat/test-scale-date.R
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ test_that("not cached across calls", {
})

test_that("time scale date breaks and labels work", {
skip_if_not_installed("hms")

d <- c(base_time(), base_time() + 5 * 24 * 3600) - base_time()


Unchanged files with check annotations Beta

position = "bottom",
sec.axis = waiver()) {
sc <- datetime_scale(
ggplot_global$x_aes,
"hms",

Check warning on line 241 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L239-L241

Added lines #L239 - L241 were not covered by tests
name = name,
palette = identity,

Check warning on line 243 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L243

Added line #L243 was not covered by tests
breaks = breaks,
date_breaks = date_breaks,

Check warning on line 245 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L245

Added line #L245 was not covered by tests
labels = labels,
date_labels = date_labels,

Check warning on line 247 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L247

Added line #L247 was not covered by tests
minor_breaks = minor_breaks,
date_minor_breaks = date_minor_breaks,
guide = guide,

Check warning on line 250 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L249-L250

Added lines #L249 - L250 were not covered by tests
limits = limits,
expand = expand,
oob = oob,
position = position

Check warning on line 254 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L254

Added line #L254 was not covered by tests
)
set_sec_axis(sec.axis, sc)

Check warning on line 257 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L257

Added line #L257 was not covered by tests
}
position = "left",
sec.axis = waiver()) {
sc <- datetime_scale(
ggplot_global$y_aes,
"hms",

Check warning on line 280 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L278-L280

Added lines #L278 - L280 were not covered by tests
name = name,
palette = identity,

Check warning on line 282 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L282

Added line #L282 was not covered by tests
breaks = breaks,
date_breaks = date_breaks,

Check warning on line 284 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L284

Added line #L284 was not covered by tests
labels = labels,
date_labels = date_labels,

Check warning on line 286 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L286

Added line #L286 was not covered by tests
minor_breaks = minor_breaks,
date_minor_breaks = date_minor_breaks,
guide = guide,

Check warning on line 289 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L288-L289

Added lines #L288 - L289 were not covered by tests
limits = limits,
expand = expand,
oob = oob,
position = position

Check warning on line 293 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L293

Added line #L293 was not covered by tests
)
set_sec_axis(sec.axis, sc)

Check warning on line 296 in R/scale-date.R

Codecov / codecov/patch

R/scale-date.R#L296

Added line #L296 was not covered by tests
}
#' Date/time scale constructor