[Python] Plotly displaying sad 'fail' face instead of output

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024.

  1. Stack

    Stack Membro Participativo

    I'm using plotly==4.5.1 in a jupyter==1.0.0 notebook, python==3.7.4.

    The same piece of code which previous showed this:

    [​IMG]

    Is now showing this, without having had any modifications:

    [​IMG]

    Does anyone have any insights over why this might be? Is it something to do with plotly's online/offline modes?

    For completeness, here is some example dummy data

    df_heat = pd.DataFrame({'lat': {0: -62.884215, 1: -62.834226, 2: -62.811707, 3: -62.744564, 4: -62.704835},
    'lon': {0: 39.4402361, 1: 39.4080722, 2: 39.3804616, 3: 39.4891116, 4: 39.4243305},
    'count': {0: 1, 1: 1, 2: 1, 3: 1, 4: 1}})


    And the code used to create the map.

    import plotly.graph_objects as go

    fig = go.Figure(go.Densitymapbox(lat=df_heat['lat'], lon=df_heat['lon'], z=df_heat['count'],
    radius=10,))
    fig.update_layout(mapbox_style="carto-positron", mapbox_zoom=10, mapbox_center = {"lat": 40.7831, "lon": -73.9712},)

    fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
    fig.show()

    Update (before any answers were posted)


    Restarting my computer seemed to solve this issue ¯\_(ツ)_/¯. Insight on why it happened would still be appreciated.

    Continue reading...

Compartilhe esta Página