Basic Radar Chart with Dash

Hi!
I’ve been trying to follow up this tutorial here:

It does not seem very difficult, but I’m getting completely different results.
I have this:

r = [28, 81, 4, 3]
theta = [19498, 9144, 6245, 799]

r is number of visits
theta is ID’s
So I build my chart like this in a callback function:

data = [go.Scatterpolar(r=r, theta=theta, fill='toself')]
layout = go.Layout(polar=dict(radialaxis=dict(visible=True),), showlegend=True)
return {'data': data,'layout': layout}

and I get nothing similar to the chart I see at the section “Basic Radar Chart with go.Scatterpolar”
I get this:

What do I need to do to achieve the chart that is shown in the tutorial, where I’d have ID’s instead of degrees and the markers correctly reflecting the number of visits?

You need the angular axis to be of type category. You can either define it in the figure’s layout or change your IDs from numbers to strings:

theta = ["19498", "9144", "6245", "799"]
1 Like

Hmmm, I explicitly set the lists in my function body to:

r = [28, 81, 4, 3]
theta = ["19498", "9144", "6245", "799"]

but I’m still getting:

Alright, then go for the second option:

layout = go.Layout(
    polar=dict(
        radialaxis=dict(visible=True),
        angularaxis=dict(type="category")
    ),
    showlegend=True
)
1 Like

That worked perfectly, and I did not even have to set the theta values to strings.