在底部设置标题

set plotly title in the bottom

我尽量把标题放在最下面。我看到了 yanchor = "bottom" 属性,但无法使用它。

有什么想法吗?

iris %>% 
  count(Species) %>% 
  plot_ly(labels = ~ `Species`,
                    values = ~n,
                    type = 'pie',
                    textposition = 'inside',
                    textinfo = 'label+percent',
                    insidetextfont = list(color = '#FFFFFF'),
                    hoverinfo = 'label+percent',
                    showlegend = FALSE) %>% 
  layout(title = "I need to be in the bottom")

您可以使用此代码:

iris %>% 
    count(Species) %>% 
    plot_ly(labels = ~ `Species`,
            values = ~n,
            type = 'pie',
            textposition = 'inside',
            textinfo = 'label+percent',
            insidetextfont = list(color = '#FFFFFF'),
            hoverinfo = 'label+percent',
            showlegend = FALSE) %>% 
    layout(title = list(text = "I need to be in the bottom", y = 0.05))

输出: