Skip to content

Commit e4917a3

Browse files
committed
fix x label spacing
1 parent dc372f1 commit e4917a3

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

R/set.up.plot.area.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ add.axis.label <- function(axisGrob, axis.label, axis.position, axis.label.cex,
9292
just <- c('centre', 'top');
9393
rot <- 0;
9494
x <- unit(0.5, 'npc');
95-
y <- getGrob(axisGrob, 'labels')$y * max(1, (axis.label.cex + axis.cex));
95+
96+
y <- unit(
97+
convertY(getGrob(axisGrob, 'labels')$y, 'mm', valueOnly = TRUE) -
98+
convertY(unit(1.2, 'lines') * axis.cex, 'mm', valueOnly = TRUE),
99+
'mm'
100+
);
96101
} else {
97102
pushViewport(vp);
98103

@@ -134,7 +139,7 @@ add.axis.label <- function(axisGrob, axis.label, axis.position, axis.label.cex,
134139
name = 'axis.label',
135140
axis.label,
136141
gp = gpar(cex = axis.label.cex),
137-
vjust = 0,
142+
vjust = 1,
138143
x = x,
139144
rot = rot,
140145
y = y

0 commit comments

Comments
 (0)