增加绘图标题的大小

Increasing the size of the title of a plotly graphic

我正在使用 plotly 4.5.2

以下是我如何通过在 layout() 中使用 titlefont=list(size=30) 来更改绘图标题的大小:

library(plotly)
x <- 0:10
y <- 0:10
dd <- transform(expand.grid(x=x, y=y), z=x+y)
dd1 <- data.frame(x=x, y=y) 
pp <- plot_ly() %>% 
  layout(title="Hello", titlefont=list(size=30)) %>%
  add_trace(data=dd, x=~x, y=~y, z=~z, type="heatmap") %>% 
  add_trace(data=dd1, x=~x, y=~y, type="scatter", mode="lines", showlegend=FALSE)

但是标题太大时无法正确呈现:

是bug还是我做错了什么?

您可以手动设置图形大小。尝试以下操作:
pp %>% layout(autosize = F, height = 500, margin = list(l=50, r=50, b=100, t=100, pad=4))

Title is visible now