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_layout(polar=dict(radialaxis=dict(visible=True, range=[-1, 1])), width=500, height=500, title_text="Radar chat with color", title_x=0.5)
fig.update_traces()
fig.show()
Current result:
Expected result:
Any help or workaround would be much appreciated!
Best,
Simone