plotly.graph_objects 中的蜘蛛图形线

jos*_*rdo 4 django plotly python-3.6

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

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
)
Run Code Online (Sandbox Code Playgroud)

图像:

在此输入图像描述

我将关注您对这个主题的帮助。

小智 7

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])
Run Code Online (Sandbox Code Playgroud)

然后使用

r=r_list
Run Code Online (Sandbox Code Playgroud)