plotly.graph_objects 中的蜘蛛图形线

spider graphic line in plotly.graph_objects

然而,当我生成图表时,线条并没有结束,我尝试了很多方法,但没有任何效果。

r 中是什么,是我用已经定义的值声明的一些变量

fig = go.Figure()


fig.add_trace(go.Scatterpolar(
    name = "Ideal",
    r=[ ideal_Funciones_Responsabilidades, ideal_etapas_propias, ideal_Aspectos_Legales, ideal_Gestion_Ambiental, ideal_Gestion_de_Seguridad, 
    ideal_manejo_Informacion, hallado_Tecnicos, ideal_Humanos , ideal_transversales],
    theta=categories,

    #connectgaps=True,
    #line_color = 'darkviolet'   

    type= 'scatterpolar',
    mode = 'lines',


))

fig.add_trace(go.Scatterpolar(
    name = "Hallado",
    r=[ hallado_Funciones_Responsabilidades, hallado_etapas_propias, hallado_Aspectos_Legales, hallado_Gestion_Ambiental, hallado_Gestion_de_Seguridad, 
    hallado_manejo_Informacion, hallado_Tecnicos, hallado_Humanos, hallado_transversales],
    theta=categories,
    #mode = "markers",


    type= 'scatterpolar',
    mode = 'lines',
    #line_color = 'peru'




))




fig.update_layout(

    polar=dict(


        radialaxis=dict(

            #visible=True,
            range=[0, maximo_valor + 1]
        )

        ),
    #line_close=True,
    # showlegend=False
)

Image:

我会注意你对这个话题的帮助。

您可以使用 go.Scatterpolar() 关闭该行,方法是在列表末尾为 r 和 theta 重复列表中的第一个元素。

假设您声明:

r_list=[ ideal_Funciones_Responsabilidades, ideal_etapas_propias, ideal_Aspectos_Legales, ideal_Gestion_Ambiental, ideal_Gestion_de_Seguridad, 
ideal_manejo_Informacion, hallado_Tecnicos, ideal_Humanos , ideal_transversales]
r_list.append(r_list[0])

然后使用

r=r_list