графическая линия паука в plotly.graph_objects - PullRequest
1 голос
/ 22 октября 2019

Когда я генерирую свой график, линия не заканчивается, однако, и я пытался разными способами, но у меня ничего не получалось.

то, что в 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
)

Изображение:

enter image description here

Я буду внимателен к вашей помощи в этой теме.

1 Ответ

0 голосов
/ 23 октября 2019

Вместо go.Scatterpolar(), используйте px.line_polar() и установите line_close=True

График 1: line_close=True

enter image description here

Участок 2: line_close=False

enter image description here

Полный код:

import plotly.express as px
import pandas as pd
df = pd.DataFrame(dict(
    r=[1, 5, 2, 2, 3],
    theta=['processing cost','mechanical properties','chemical stability', 
           'thermal stability', 'device integration']))
fig = px.line_polar(df, r='r', theta='theta', line_close=False)
fig.show()

Похоже, что нет аналогичной опции для go.Scatterpolar().

...