How to allow traces to overlap on plotly?

Viewed 134

How should I allow the traces of line and markers to overlap on a plotly map for scattermapbox function?

fig = go.Figure(go.Scattermapbox())

fig.add_trace(go.Scattermapbox(
    mode = "lines", #lines 
    lon =longlist,
    lat = latlist,
    marker = {'size': 1, 'opacity' : 0.7}))


fig.add_trace(go.Scattermapbox(
    mode= "markers", #markers
    lon = df['Longitude'], lat = df['Latitude'],
    text = df['text'],
    marker_color = "aqua",
    
    
))





    

# fig.update_geos(
# resolution=50,projection_type='wagner6'

# )

fig.update_layout(height=500, margin={"r":0,"t":40,"l":0,"b":0},mapbox = {
        'style': "carto-positron",
        'center': {'lon':103.8198, 'lat': 1.3521},
        'zoom': 10.2}, title ="Singapore MRT stations"
                 )
fig.update_traces(marker=dict(size=20))
# Size




fig.show()

At the marker size of 20, only the lines are shown with the markers hidden. Showing only the markers are shown

When I change the size marker size to 50, only the markers are shown and the lines are not shown. enter image description here

I would like to show both at the same time even if they are overlapping.

0 Answers
Related