✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Avoid overlap in tick label

When I render a plot for boxplot for example, the data has a lot of unique numerical values and the plot adds a tick label for every value. I believe when the values are ‘strings’ it spaces all the boxes by equal heights. Is there a way to hide some labels automatically or add an autospacing sort of like the automargin option?

When plotting categories (I think this what you’re trying to plot, right?), we’ll plot all of them regardless of the space available, as there’s no obvious way to determine which categories to hide.

Setting yaxis.automargin: true will add padding to the left to make the labels fit horizontally, but here you’ll looking to expand the plotting area, which with set layout.width and layout.height and axis domain, the only way would be to auto-shrink the margins. This is something we do allow yet.

As a workaround, you could try setting yaxis.tickvals to the array of y-coordinates on your graphs and yaxis.ticktext to something like ['label 0, '', 'label 2', '' , /* ... */] where the '' are hidden labels.

@etienne Hi, I opened a github ticket for this because I came across it again. The problem with adding empty strings like you suggest using ticktext is what is the calculation on when and how to do this effectively? I think this was confusing to use the example of automargin but what I mean is an ability to pass a flag that allows labels to be automatically hidden if they are to overlap even if the user specifies ticktext and tickvals. See the case I opened for more details.


already tried the “closest” options of the hovermode property?

Or maybe cliponaxis with layer