How to remove background lines (zerolines, gridlines) in Barpolar Plot?

Hello,

Is there a way to remove background lines in a Barpolar plot?

So far I’ve tried updating the layout according to the documentation but to no effect: Axes with Python
How to disable grid lines in heatmap plot?
python - How to set background color of the plot and color for gridlines? - Stack Overflow

fig.update_layout(xaxis_showgrid=False, yaxis_showgrid=False)

I also tried another option such as:

fig.update_xaxes(showgrid=False, zeroline=False)
fig.update_yaxes(showgrid=False, zeroline=False)

This did not work either.

strong text

So how does one remove the lines or turn them off or make them invisible? Any ideas?

fig = go.Figure(
    go.Barpolar(
        r=scaled_bidrates,
        theta=theta,
        width=width,
        marker={
            "colorscale": px.colors.sequential.Reds,
            "showscale": True,
            "color": df['winrate'],
            "line_color": None,
            "line_width": 1,
            "cmin": df['winrate'].min(),
            "cmax": df['winrate'].max(),
        },
        text=labels,    
        hoverinfo='all' 
    )
)
angular_tickvals = [(i + 1) * 360 / num_slices for i in range(num_slices)]

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=False, ticks=''),
        angularaxis = dict(showticklabels=False, ticks=''),
    ),
    polar_angularaxis_tickvals=angular_tickvals,
    height=500,
    title='Performance Chart'
)
#fig.update_xaxes(showgrid=False, zeroline=False)
#fig.update_yaxes(showgrid=False, zeroline=False)
fig.update_layout(xaxis_showgrid=False, yaxis_showgrid=False)
fig.show()

FYI
And please follow this below.

Are you suggesting that I should use Sunburst? Otherwise, I haven’t found anything there that concerns turning off grids.

The thing is my data is not hierarchical and it doesn’t seem like it would suit my purpose, and this is also more or less a workaround as I was intending to use Pie class but unfortunately it did not offer me the option of adjusting the radius.

In any case, I will provide a snippet with the code that I used. Thanks!

FYI

Alright, thank you.
That solved the problem. Then I went further and attempted to remove the circle by adjusting the angularaxis color to white which helped but it still left a line.

image

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=False, ticks='',),
        angularaxis = dict(showticklabels=False, ticks='', linecolor='White'),
    ),
    polar_radialaxis_gridcolor="#ffffff",
    polar_angularaxis_gridcolor="#ffffff",
    polar_angularaxis_tickvals=angular_tickvals,
    height=500,
    title='Performance Chart'
)

Now, I tried to remove that extra line by changing the linecolor='White' in radialaxis but it leaves an actual white line color. Is there a way to remove that?

image

fig.update_polars(radialaxis_showline=False)
@geosphere

import plotly.express as px

df = px.data.wind()
fig = px.bar_polar(df,
                   r="frequency",
                   theta="direction",
                   color="strength",
                   color_discrete_sequence=px.colors.sequential.Plasma_r)
fig.update_layout(
    polar_radialaxis_gridcolor="white",
    polar_angularaxis_gridcolor="white",
    polar=dict(
        radialaxis=dict(
            showticklabels=False,
            ticks='',
        ),
        angularaxis=dict(showticklabels=False, ticks='', linecolor='White'),
    ),
)
fig.update_polars(radialaxis_showline=False, bgcolor='white')
fig.show()
2 Likes

That did not quite fix my problem as it’s coloring the line to black instead like in the first picture. I guess this has to do with something else.

Thank you, @stu, that helped. I couldn’t quite figure out the name for that axis. Just today as I was playing out with the radialaxis I found out that name and recalled that edited the topic with this answer.

Many thanks!

By the way, is there a way to adjust each radial axis individually? Or pass as an argument a list of values or something to create a radial axis for certain radius value?

Let’s say in the example below I would like to draw a radial line/circle and if that line could be dashed? I couldn’t find a linestyle param in the documentation Layout.polar in Python

image

dtick ?

Okay, it worked, I managed to set the average line. Not sure why I overlooked it but then how would I set 2 other circles.
For example, the line in the image is the avg one and I’d want to add 2 other circles, one with the min and one with the max, and hopefully remove the 0 in the middle.

And how could I make that line dashed or better yet customize each circle/line?

image

I guess I could set tick0 to the min value then for dtick I’ll just set the value I want and subtract from that with the value of tick0 so that it represents the value that I want.

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=True, ticks='', linecolor='White', dtick=avg-1, tick0=1),
        angularaxis = dict(showticklabels=False, ticks='', linecolor='White'),
    ),

I think I figured it out, I used tickvals, tickformat

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=True, ticks='outside', linecolor='White', linewidth=1.5, tickvals=[min_bd, avg, max_bd], tickformat='.2f'),
        angularaxis = dict(showticklabels=False, ticks='', linecolor='White'),
    ),
1 Like

@stu, is there a way to change the radialaxis linestyle to dashed or some other style? I couldn’t find a mention in the documentation.

I don’t know. I didn’t see such a use case.