Home > Blockchain >  set plotly title in the bottom
set plotly title in the bottom

Time:03-18

I try to put the title in the bottom. I saw the yanchor = "bottom" attribute but cant manage to use it.

Any idea ?

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")

enter image description here

CodePudding user response:

You can use this code:

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))

Output:

enter image description here

  • Related