Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Trouble in bar graphs/y axis


I’m new to plotly, so forgive me if this is something trivial. I am creating some sort of ranking and for that purpose I’m using bar chart. It’s pretty important to have people’s complete name shown on the chart, however I can’t control where the bars begin to give more space to names, as follows:

Here is the code I’m using:

output$disp_ranking <- renderPlotly({
     plot_ly() %>%
                add_trace(y = reorder(ranking$name, ranking$total),
                          x = ranking$amount1,
                          name = 'Amount 1', type = 'bar', orientation = 'h', text = ranking$amount1, textposition = 'inside') %>%
                add_trace(y = reorder(ranking$name, ranking$total),
                          x = ranking$amount2,
                          name = 'Amount 2', text = ranking$amount2, textposition = 'inside') %>%
                add_trace(y = reorder(ranking$Nome_Servidor, ranking$Total),
                          x = ranking$amount3,
                          name = 'Amount 3', text = ranking$amount3, textposition = 'inside') %>%
                layout(barmode = 'stack',
                       xaxis = list(autotick = FALSE,
                                    ticks = "inside",
                                    tick0 = 0,
                                    dtick = 1,
                                    ticklen = 10,
                                    tickwidth = 2))

I would be really thankful if someone could help me or even suggest another library more optimized for rankings I could use.

Hey @rychardguedes

sounds like you want to adjust the margins see example here