Skip to content

Commit c949e42

Browse files
committed
translate hjust in plot.title theme to layout.title's new placement API
1 parent 2fe5cfc commit c949e42

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/ggplotly.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,11 @@ gg2list <- function(p, width = NULL, height = NULL,
439439
if (nchar(plot$labels$title %||% "") > 0) {
440440
gglayout$title <- list(
441441
text = faced(plot$labels$title, theme$plot.title$face),
442-
font = text2font(theme$plot.title)
442+
font = text2font(theme$plot.title),
443+
# don't translate vjust to y since they since have very different meaning...
444+
# y is allowed to span the paper coordinate whereas vjust it local to it's grob
445+
x = theme$plot.title$hjust,
446+
xref = "paper"
443447
)
444448
gglayout$margin$t <- gglayout$margin$t + gglayout$title$font$size
445449
}

0 commit comments

Comments
 (0)