我正在尝试创建一个空plotly
,并显示一条消息,说明为什么该图作为标题为空。我想将消息水平和垂直居中。
我缺少垂直中心:
empty_plot <- function(title = NULL){
p <- plotly_empty(type = "scatter", mode = "markers") %>%
config(
displayModeBar = FALSE
) %>%
layout(
title = title
)
return(p)
}
empty_plot("Why it is empty")
答案 0 :(得分:0)
仅找到选项yref = "paper"
,中间位置为y = 0.5
empty_plot <- function(title = NULL){
p <- plotly_empty(type = "scatter", mode = "markers") %>%
config(
displayModeBar = FALSE
) %>%
layout(
title = list(
text = title,
yref = "paper",
y = 0.5
)
)
return(p)
}
empty_plot("Why it is empty")