# Polar chart - fill percent of aea like a pie chart

**URL:** <https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984>\
**Category:** 📊 Plotly Python\
**Created:** [November 26, 2018, 12:43am UTC](https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984 "2018-11-26T00:43:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon30707302](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@anon30707302](https://community.plotly.com/u/anon30707302)\
**Post date:** [November 26, 2018, 12:43am UTC](https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984/1 "2018-11-26T00:43:39Z")

</div>

Hi guys,

Maybe I’m just dumb, but I’ve been trying all night with no luck.

Is it possible to fill an area of a polar chart like a pie chart?

I don’t want the fill to go over zero. It should rotate around 0, like a pie chat would.

I’ve changed the fill attribute to ‘tonext’ and ‘toself’, both produce the same result.

![newplot](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/84d384b3adc13e3dd9d5d7f8aff2a925ddd0d5ca.png)

```auto
theta = np.linspace(120, 310, 1000)
r = np.ones(len(theta))

polar_data = [
    go.Scatterpolar(
        r = r,
        theta = theta,
        mode = 'lines',
        fill = 'toself',
        fillcolor = '#0A8883',
        marker = dict(color = '#0A8883'),
        opacity = 0.7
    )
]

polar_layout = go.Layout(
    title='',
    showlegend = False,
    autosize=False,
    width=450,
    height=500,
    margin=go.layout.Margin(
         l=40,
         r=80,
         b=50,
         t=50,
         pad=0),
    polar = dict(radialaxis = dict(tickfont = dict(size = 12)),
                 angularaxis = dict(tickfont = dict(size = 12),
                                    rotation = 90,
                                    direction = "counterclockwise")),
)

fig = go.Figure(data=polar_data, layout=polar_layout)

```

---

<div class="post-metadata">

**Author:** ![anon30707302](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@anon30707302](https://community.plotly.com/u/anon30707302)\
**Post date:** [November 26, 2018, 1:37am UTC](https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984/2 "2018-11-26T01:37:25Z")

</div>

Ahh ok, I’ve fixed it. The 2:36am magic has helped.

You have to start/finish the arrays with 0. This forces the fill to go to zero at either end.

```auto
theta = np.array([0])
theta = np.append(theta, np.linspace(120, 310, 1000))
theta = np.append(theta, 0)
r = np.array([0])
r = np.append(r, np.ones(len(theta)-2))
r = np.append(r, 0)

```

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [November 28, 2018, 10:57am UTC](https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984/3 "2018-11-28T10:57:04Z")

</div>

Hi @anon30707302, glad you got something working!

Just wanted to point out that you could also do this with a single bar in a barpolar trace ([https://plot.ly/python/wind-rose-charts/](https://plot.ly/python/wind-rose-charts/)).

```python
import plotly.graph_objs as go

fig = go.Figure()
bp = fig.add_barpolar(r=[1], theta=[315], width=[180])

```

 ![newplot](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/b/bf55682afc24b2c3fc6db407834a329534594262.png)

-Jon

---

<div class="post-metadata">

**Author:** ![anon30707302](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@anon30707302](https://community.plotly.com/u/anon30707302)\
**Post date:** [November 28, 2018, 12:49pm UTC](https://community.plotly.com/t/polar-chart-fill-percent-of-aea-like-a-pie-chart/15984/4 "2018-11-28T12:49:27Z")

</div>

Oh perfect, even better! Thanks!
