fix(logo): reserve a logo band in add_logo_ga() instead of a negative margin (#28)
R-CMD-check / R CMD check (push) Successful in 4m38s
R-CMD-check / R CMD check (push) Successful in 4m38s
add_logo_ga() now gives the logo its own band (logo_height inches) below the plots, as add_logo() does, and leaves plot margins alone unless margin_param is given. Closes #28 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2a0fce265
commit
f3ec052144
4 files changed
+53
-18
No files matched your search
@@ -111,3 +111,28 @@ test_that("the logo keeps its aspect ratio at any canvas width (#20)", {
|
||||
expect_lt(diff(range(aspects)) / mean(aspects), 0.03, label = type)
|
||||
}
|
||||
})
|
||||
|
||||
# --- add_logo_ga() layout (#28) ----------------------------------------------
|
||||
|
||||
test_that("add_logo_ga reserves a logo band instead of using negative margins", {
|
||||
logo <- make_logo_grob()
|
||||
composed <- add_logo_ga(list(caption_plot(), caption_plot()), logo, logo_height = 0.6)
|
||||
heights <- composed_table(composed)$heights
|
||||
expect_equal(length(heights), 2)
|
||||
expect_true(any(grepl("null", as.character(heights))))
|
||||
expect_true(any(grepl("0.6", as.character(heights))))
|
||||
})
|
||||
|
||||
test_that("add_logo_ga does not clip captions at several canvas sizes", {
|
||||
skip_on_cran()
|
||||
logo <- make_logo_grob()
|
||||
for (nrow in c(1, 2)) {
|
||||
for (w in c(8, 11, 16, 24)) {
|
||||
composed <- suppressWarnings(
|
||||
add_logo_ga(list(caption_plot(), caption_plot()), logo, nrow = nrow)
|
||||
)
|
||||
ink <- bottom_ink(composed, w, w * 0.64)
|
||||
expect_equal(ink, 0, info = paste("nrow", nrow, "width", w))
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user