# Radar chart - fill between based on a condition

Dear all,

I am trying to create a radar chart with colouring based on a condition.
I am taking inspiration from this post on StackOverflow but couldn’t implement it properly.
The condition shown here is a color property based on ‘res’: [red < 0 < green].
Below, I add a code snippet of what worked so far with ‘fillcolor’, and a possible expected result.

``````import plotly.graph_objects as go
import plotly.io as pio
pio.templates.default = "plotly_white"

r=[0, 0, 0, 0, 0, 0]
theta=['Property 1', 'Property 2', 'Property 3', 'Property 4', 'Property 5', 'Property 6', 'Property 1']
res = [0.5, 0.5, 0.5, -0.5, -0.5, -0.5, 0.5]
color_s = 'rgba(125, 125, 125, 0.4)'

fig = go.Figure()
fig.add_trace(go.Scatterpolar(r=[0, 0, 0, 0, 0, 0, 0], theta=theta, fill=None, name='T-Score'))
fig.add_trace(go.Scatterpolar(r=res, theta=theta, fill='tonext', line_color=color_s, fillcolor=color_s, name='Data'))
fig.update_traces()
fig.show()
``````

Current result: Expected result: Any help or workaround would be much appreciated!
Best,
Simone

Hi @simone_p,
To assign different colors to the two regions, some computations are needed, but with your settings they are impossible, because in mathematics the polar radius cannot be negative. If you reference all points involved in your figure to a polar system with origin at 0, i.e. with the following code:

``````import plotly.graph_objects as go

color_s = 'rgba(125, 125, 125, 0.4)'
fig = go.Figure()
template="plotly_white",
width=450, height=450#, title_text="Radar chart with color", title_x=0.5
)
theta=['Property 2', 'Property 3', 'Property 4', 'Property 5', 'Property 6', 'Property 1'] 