Black Lives Matter. Please consider donating to Black Girls Code today.

Scattermapbox - no markers/plotting coordinates

I have some code that creates a list of dictionaries with coordinates to plot. The map is rendering fine, however, there aren’t any markers or coordinates. The data object contains a list of coordinates, so my suspicion is some issue with plotly/scattermapbox.

Here’s my code:

def update_graph(selected_value):

# Filter the dataframe with selected value
Comp_data = EmpComm1[EmpComm1['Company'] == selected_value]

data = []    
# Plot home location and map commute to work. 
# Create a data dictionary of lat and lon to plot
for i, row in Comp_data.iterrows():

    lat, long = row['HomeLocation']

    data.append({
            "type": "scattermapbox",
            "lat": lat,
            "lon": long,
            "mode": "markers",
            "marker": {
                "symbol": "circle-dot",
                "color": "grey",
                "size": 10,
                "opacity": 0.7
                }
            })


layout = {
     "autosize": True,
     "hovermode": "closest",
     "mapbox": {
         "accesstoken": MAPBOX_KEY,
         "bearing": 0,
         "center": {
             "lat": 37.77,
             "lon": -122.43
         },
         "pitch": 0,
         "zoom": 10,
         "style": "outdoors"
     }
}    

return {"data": data, "layout": layout}

Data Object:

[{'type': 'scattermapbox',
'lat': 37.70542367598618,
'lon': -121.83596766086245, 
'mode': 'markers',
'marker': {'size': 3, 'opacity': 1.0}},
{'type': 'scattermapbox',
'lat': 37.5646475449362,
'lon': -121.78437649150582,
'mode': 'markers',
'marker': {'size': 3, 'opacity': 1.0}},
.
.
.

The Fix:

“lat”: [lat],
“lon”: [long]

I do have the same issue. Did you find any solution ?

While usingScattermapbox, I noticed that only the symbol “circle” get plotted. If you change to Diamond or whatever, it does not plot.

Any solution? A bug to fix?