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

**URL:** <https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [April 8, 2022, 5:54am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849 "2022-04-08T05:54:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 8, 2022, 5:54am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/1 "2022-04-08T05:54:12Z")

</div>

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](https://plotly.com/python/axes/#styling-and-coloring-axes-and-the-zeroline)  
[How to disable grid lines in heatmap plot?](https://community.plotly.com/t/how-to-disable-grid-lines-in-heatmap-plot/30899)  
[python - How to set background color of the plot and color for gridlines? - Stack Overflow](https://stackoverflow.com/questions/62962623/how-to-set-background-color-of-the-plot-and-color-for-gridlines)

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

I also tried another option such as:

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

```

This did not work either.

**strong text**

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/4/4/44e90938db5eb2fcd51d51901c2b78370190f8d0.png)

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

```auto
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()

```

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [April 8, 2022, 7:22am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/2 "2022-04-08T07:22:17Z")

</div>

> **[Sunburst](https://plotly.com/python/sunburst-charts/)**
>
> Over 15 examples of Sunburst Charts including changing color, size, log axes, and more in Python.

FYI  
And please follow this below.

> [@How to write a Minimal Reproducible Example (MRE)](https://community.plotly.com/t/how-to-write-a-minimal-reproducible-example-mre/61502):
>
> Adding a minimal reproducible example to your questions will help attract community members to answer your question. The goal of writing a MRE is to allow other members of the community to run the code on their computers and “reproduce” the error, so that they can best help you. Please make sure that your MRE includes data and that the code is correctly pre-formatted. To preformat, copy and paste the code in your post and then click on \</\> (Preformatted text), as shown on the image:

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 8, 2022, 7:25am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/3 "2022-04-08T07:25:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [April 8, 2022, 7:52am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/4 "2022-04-08T07:52:01Z")

</div>

> [@Plot\_bgcolor not working for radar plot using Scatterpolar](https://community.plotly.com/t/plot-bgcolor-not-working-for-radar-plot-using-scatterpolar/44039/4):
>
> Here you go, it’s a bit hidden fig.update\_layout( polar\_radialaxis\_gridcolor="#ff0000", polar\_angularaxis\_gridcolor="#0000ff", ) you can also update linecolor this way

FYI

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 8, 2022, 8:30am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/5 "2022-04-08T08:30:58Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/7/e76880adf5d17af4844439f6f81dd5a6abbfc38e.png)

```auto
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](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/9/99bbc3c993e82fcdcade46bf6a92ab22d7f343b1.png)

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [April 8, 2022, 8:51am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/6 "2022-04-08T08:51:50Z")

</div>

`fig.update_polars(radialaxis_showline=False)`  
@geosphere

```auto
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()

```

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 8, 2022, 9:07am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/7 "2022-04-08T09:07:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 12, 2022, 11:43am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/8 "2022-04-12T11:43:18Z")

</div>

> [@stu](#):
>
> fig.update\_polars(radialaxis\_showline=False)

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](https://plotly.com/python/reference/layout/polar/#layout-polar-radialaxis)

![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/c/6/c6a1e0c4bf7d892ad0364d6bc3acce02efcf8e91.png)

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [April 12, 2022, 12:02pm UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/9 "2022-04-12T12:02:01Z")

</div>

> **[Layout.polar](https://plotly.com/python/reference/layout/polar/#layout-polar-angularaxis)**
>
> Figure

[dtick](https://plotly.com/python/reference/layout/polar/#layout-polar-angularaxis-dtick)?

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 12, 2022, 12:28pm UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/10 "2022-04-12T12:28:53Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/8/b/8b94d4045d675371fb8d4e92bc71ebf1eea6bd74.png)

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.

```auto
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'),
    ),

```

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 13, 2022, 6:40am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/11 "2022-04-13T06:40:34Z")

</div>

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

```auto
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'),
    ),

```

---

<div class="post-metadata">

**Author:** ![geosphere](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@geosphere](https://community.plotly.com/u/geosphere)\
**Post date:** [April 13, 2022, 7:35am UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/12 "2022-04-13T07:35:33Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [April 13, 2022, 3:19pm UTC](https://community.plotly.com/t/how-to-remove-background-lines-zerolines-gridlines-in-barpolar-plot/62849/13 "2022-04-13T15:19:28Z")

</div>

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