I’m using creating a radar-chart with multiple inputs using this tutorial https://plotly.com/python/radar-chart/.
Though I’ve gotten it to work, I still cannot join the opening and closing points (the one between openness and neuroticism here).
def plotly_draw(list_of_dictionaries):
ocean_subclasses = [
'Openness',
'Conscientiousness',
'Extraversion',
'Agreeableness',
'Neuroticism'
]
score_list = []
tag_list = []
for dictionary in list_of_dictionaries:
score_list.append(list(dictionary.values())[0])
tag_list.append(list(dictionary.keys())[0])
fig = go.Figure()
for score, legend_tag in zip(score_list, tag_list):
fig.add_trace(go.Scatterpolar(
r=score,
theta=ocean_subclasses,
fill='toself',
connectgaps=True,
name=legend_tag,
# visible='legendonly', # disabled because it confuses new users about where their graph is
))
max_num = 0
min_num = 0
for score in score_list:
if max_num < max(score):
max_num = max(score)
if min_num > min(score):
min_num = min(score)
max_num = round(max_num + 5.1, -1)
min_num = round(min_num - 5.1, -1)
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True,
range=[min_num, max_num]
)),
showlegend=True,
legend=dict(x=1.15, y=0.8),
font=dict(
family="Courier New, monospace",
size=15,
color="#5a2f7c"
)
)
return plot(
fig, output_type='div',
auto_open=False, image_filename='ocean_plot',
)
Is doing that possible. If yes, then how? Thank you very much.
EDIT: The function takes input like this
[{'testuser':[6, 4, 3, 10, 5]},
{'testuser2':[1, 5, 17, 20, 6]}]