Skip to content

Commit 4ee8b13

Browse files
author
Rasmus
committed
guides-axis: make assignment a bit more elegant
1 parent 8340ec7 commit 4ee8b13

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

R/guides-axis.r

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ guide_axis <- function(at, labels, position = "right", theme) {
1414
zero <- unit(0, "npc")
1515
one <- unit(1, "npc")
1616

17-
theme$axis.ticks.length.x <- theme$axis.ticks.length.x %||% theme$axis.ticks.length
18-
theme$axis.ticks.length.x.bottom <- theme$axis.ticks.length.x.bottom %||% theme$axis.ticks.length.x
19-
theme$axis.ticks.length.x.top <- theme$axis.ticks.length.x.top %||% theme$axis.ticks.length.x
20-
theme$axis.ticks.length.y <- theme$axis.ticks.length.y %||% theme$axis.ticks.length
21-
theme$axis.ticks.length.y.left <- theme$axis.ticks.length.y.left %||% theme$axis.ticks.length.y
22-
theme$axis.ticks.length.y.right <- theme$axis.ticks.length.y.right %||% theme$axis.ticks.length.y
17+
theme$axis.ticks.length.x.bottom <- with(theme,
18+
axis.ticks.length.x.bottom %||%
19+
axis.ticks.length.x %||%
20+
axis.ticks.length)
21+
theme$axis.ticks.length.x.top <- with(theme,
22+
axis.ticks.length.x.top %||%
23+
axis.ticks.length.x %||%
24+
axis.ticks.length)
25+
theme$axis.ticks.length.y.left <- with(theme,
26+
axis.ticks.length.y.left %||%
27+
axis.ticks.length.y %||%
28+
axis.ticks.length)
29+
theme$axis.ticks.length.y.right <- with(theme,
30+
axis.ticks.length.y.right %||%
31+
axis.ticks.length.y %||%
32+
axis.ticks.length)
2333

2434
label_render <- switch(position,
2535
top = "axis.text.x.top", bottom = "axis.text.x.bottom",

0 commit comments

Comments
 (0)