How to add jitter to Plotly Radar chart

Viewed 58

Challenge

I'm trying to plot:

  1. a radar/spider chart with 6 categories for 1 instance
  2. data for a set of other instances on the same categories

I'd like to use a scatter plot for (2), combines with a filled line for (1). Basically like this trend line, but then on a radar chart:

enter image description here source: https://plotly.com/python/linear-fits/

Current Attempt

Using plotly, I've already gotten to this:

spider chart, the way it should look

using this code:

print(row_data)
    fig.add_trace(go.Scatterpolar(
          r=row_data, 
          theta=theta,
          fill=fill,
          name='testdata', # name of this trace
          line=line,
          marker=marker
    ))

I now want to add dots for the second part, which looks like this per dimension:

fake points with jitter simulated

I manually added some jitter here, as I cannot find a way to do this using plotly. The code:

   other_row_data = np.random.rand(6*6) * 100
    other_theta = [*dimension_labels] * 6

    fig.add_trace(go.Scatterpolar(
          mode='markers',
          r=other_row_data, 
          # theta=other_theta,
          theta0=45,
          dtheta=0.1,
          # fill=fill,
          # name=name, # name of this trace
          line=None,
          marker=marker
    ))

The next step is to combine different plots. Combining the two above gives me this:

combined plot which introduces wrong axes

which is problematic, as both the numerical and categorical axes are now mixed. Is it possible to overlay two of these charts with different axes?

Questions

  • how do I add jitter in go.Scatterpolar?
  • how do I combine the two different plots
0 Answers
Related