我正在尝试创建一个径向图表,一切正常,但在图例中,有一个我没有指定的名为“trace 0”的按钮,我不知道如何删除它。这是帮助理解我的图表的代码:
fig = go.Figure()
fig.add_trace(go.Scatterpolar(
r = azienda_data['percentuale'].tolist() + [azienda_data['percentuale'].iloc[0]],
theta = azienda_data['Sigla'].tolist() + [azienda_data['Sigla'].iloc[0]],
fill='toself',
mode='lines+markers',
line_color='#fa440f',
marker=dict(color='#fa440f', size=8, symbol='square'
)))
fig.update_layout(
polar=dict(
radialaxis=dict(
range=[0, df['percentuale'].max() + 5]
)),
title=azienda_title,
font=dict(size=15))
legend_text = [skill for skill in sigla_skill_list if skill.split(':')[0] in azienda_data['Sigla'].tolist()]
for text in legend_text:
fig.add_trace(go.Scatterpolar(
r=azienda_data['percentuale'],
theta=azienda_data['Sigla'],
mode='markers',
marker=dict(color='#fa440f', size=6),
name=text
))
这是它的外观图片。如果按下按钮,图表中的线条和标记就会消失