diff --git a/R/themes.R b/R/themes.R index 103897b..8d8b321 100644 --- a/R/themes.R +++ b/R/themes.R @@ -158,10 +158,10 @@ theme_blank <- function( legend.margin = margin(0, 0, 0, 0), legend.key.size = grid::unit(10, "pt"), plot.margin = margin( - lab_size + 2, - lab_size + 2, - lab_size + 2, - lab_size + 2, + lab_size + 8, + lab_size + 8, + lab_size + 8, + lab_size + 8, unit = "points" ) ) @@ -212,7 +212,8 @@ theme_blank <- function( gp = grid::gpar(lwd = 2) ), grid::textGrob( - label = ylab, x = grid::unit(0, "npc"), + label = ylab, + x = grid::unit(0, "npc"), y = grid::unit(0, "npc"), vjust = -2 / 3, hjust = 0, diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..818ccf8 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(thisplot) + +test_check("thisplot") diff --git a/tests/testthat/test-themes.R b/tests/testthat/test-themes.R new file mode 100644 index 0000000..907fcdf --- /dev/null +++ b/tests/testthat/test-themes.R @@ -0,0 +1,6 @@ +test_that("theme_blank leaves room for coordinate annotation", { + theme_layers <- thisplot::theme_blank(add_coord = FALSE, lab_size = 12) + plot_margin <- theme_layers[[1]][[1]]$plot.margin + + expect_equal(as.numeric(plot_margin), rep(20, 4)) +})