How to space out categorical ticks on Y axis?

When I try to plot a horizontal bar chart with many categories, Iโ€™m having issues with overlapping Y axis tick labels. Below is some sample data to illustrate this:

tick_labs = ["label " + i for i in "abcdefghijklmnopqrstuvwxyz"]
values = [i for i in range(0,26)]

trace1 = go.Bar(
 y=tick_labs,
 x=values,
 orientation='h'
)

data = [trace1]
layout = go.Layout(
  yaxis={
    'dtick': 1,
  }
)
go.Figure(data, layout).show()

Screen Shot 2022-02-01 at 3.52.28 PM

Is there a way to insert space between each tick so the labels are more legible? Iโ€™ve had no luck adjusting bar width, graph height, or using a lot of the tick-specific parameters.

I was trying to sort this as well, the best I have is a workaround which sets the height of the plot based on the number of categories

fig_delivery = ff.create_gantt(
        df_delivery,
        colors=colors,
        index_col="ontime",
        show_colorbar=True,
        showgrid_y=True,
        height=(number_categories / 40) * 1000,
    )

The default height is 600, I just played around with numbers to get the 40 and 1000 figures that suited me.

2 Likes

Did you ever find a solution? Argument, method ? @aareay

Turns out it was just adjusting the height parameter, like in Divisorโ€™s solution. For whatever reason, this wasnโ€™t working when I posted the question, but itโ€™s more or less solved the problem now.