Skip to content

Commit ae647cb

Browse files
committed
remove offset hack
1 parent 9afbb5d commit ae647cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

R/ggplotly.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,15 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all",
446446
# npc is on a 0-1 scale of the _entire_ device,
447447
# but these units _should_ be wrt to the plotting region
448448
# multiplying the offset by 2 seems to work, but this is a terrible hack
449-
offset <- 1.75 * offset
450449
x <- if (xy == "x") 0.5 else offset
451450
y <- if (xy == "x") offset else 0.5
452451
gglayout$annotations <- c(
453452
gglayout$annotations,
454453
make_label(
455454
faced(axisTitleText, axisTitle$face), x, y, el = axisTitle,
456-
xanchor = "center", yanchor = "middle", annotationType = "axis"
455+
xanchor = if (xy == "x") "center" else "right",
456+
yanchor = if (xy == "x") "bottom" else "center",
457+
annotationType = "axis"
457458
)
458459
)
459460
}

0 commit comments

Comments
 (0)