Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Tick angles with barpolar

Hi all-

With bar polar charts, it is possible to use custom tick labels, but if these are on the longer (and plentiful) side, it would be nice to have the angle be custom to each ticklable. So far, I can only seem to change them all to one angle (i.e. all at tickangle=90, etc.). Is there a way to have each ticklabel have a unique angle?

This is my code:

data = [go.Barpolar(
    r=sub2['combo_score'],
    theta=list(sub2.index * 2.6),
    width= [1.9]* sub2.shape[0],
    marker_color=sub2['color'],
    marker_line_color="black",
    marker_line_width=0.2,
    hoverinfo='text+r',
    text=sub2['companyName'],
    opacity=0.8
)]

layout = go.Layout(polar = dict(
        radialaxis = dict(range=[6, 10], showticklabels=True),
        angularaxis = dict(showticklabels=True, tickmode='array',
                                    tickvals= list(sub2.index * 2.6),
                             ticks='outside', tickangle=45 #DOESN'T ACCEPT ARRAYS,
                            ticktext=sub2['companyName'] # THESE ARE LONG AND OVERLAP)
    ))

Hi, did you find a solution for this?

@slevin88, @mikesmith1611

Unfortunately at the moment there is no way to associate simply radial labels to Barpolar plots. Here https://plot.ly/~empet/15246
is a workaround that depends on the max r value, max text length and even on the layout.width and height.

Hi @empet. Do you know if this workaround is still required? I ask because it can offset the bars in the polarbar graph using:

fig.update_traces(offset=1.05, selector=dict(type='barpolar'))

So one would think that there must be a corresponding ticklabel tweak to offset the ticklabel accordingly (or at least put it in between ticks versus on the tick - I’ve tried:

 fig.update_polars(radialaxis_ticks="inside")
 fig.update_polars(angularaxis_ticks="inside")

But it didn’t work for me.)

Thanks!

1 Like