Skip to content

Commit a878bdb

Browse files
authored
Axis text outside panel with inward ticks (#4392)
1 parent 241b7c5 commit a878bdb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

R/guides-axis.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ draw_axis <- function(break_positions, break_labels, axis_position, theme,
280280
non_position_sizes <- paste0(non_position_size, "s")
281281
label_dims <- do.call(unit.c, lapply(label_grobs, measure_labels_non_pos))
282282
grobs <- c(list(ticks_grob), label_grobs)
283-
grob_dims <- unit.c(tick_length, label_dims)
283+
grob_dims <- unit.c(max(tick_length, unit(0, "pt")), label_dims)
284284

285285
if (labels_first_gtable) {
286286
grobs <- rev(grobs)

tests/testthat/test-theme.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ test_that("axes ticks can have independent lengths", {
562562
axis.ticks.length.x.bottom = unit(-.25, "cm"),
563563
axis.ticks.length.y.left = unit(.25, "cm"),
564564
axis.ticks.length.y.right = unit(.5, "cm"),
565-
axis.text.x.bottom = element_text(margin = margin(t = .5, unit = "cm")),
566-
axis.text.x.top = element_text(margin = margin(b = .75, unit = "cm"))
565+
axis.text.x.bottom = element_text(margin = margin(t = .25, unit = "cm")),
566+
axis.text.x.top = element_text(margin = margin(b = .25, unit = "cm"))
567567
)
568568
expect_doppelganger("ticks_length", plot)
569569
})

0 commit comments

Comments
 (0)