I am trying to plot some symbols on a Mapbox map. However, I found the symbol properties, i.e. colors, sizes etc, can only work with circle symbols. When I use other symbol types, say a triangle or diamond-dot, not only the properties wonโt be correct (they will just show as a grey symbol) but also sometimes the symbols wonโt even plot or will only plot a part of all of the data points. Here is my code:
mapbox_access_token = open(".mapbox_token").read()
fig = go.Figure()
fig.add_trace(go.Scattermapbox(
lat=lat,
lon=lon,
mode='markers',
marker=go.scattermapbox.Marker(
symbol='circle',
size=10,
color='blue',
opacity = 1
),
text=stnNames,
hoverinfo='text'
))
fig.add_trace(go.Scattermapbox(
lat=evtLat,
lon=evtLon,
mode='markers',
marker=go.scattermapbox.Marker(
symbol='star',
size=20,
color='red',
opacity = 1
),
text='event',
hoverinfo='text'
))
fig.update_layout(
title='Selected common stations',
autosize=True,
hovermode='closest',
showlegend=False,
mapbox=dict(
accesstoken=mapbox_access_token,
bearing=0,
center=dict(
lat=37.91,
lon=-77.93
),
pitch=0,
zoom=3,
style='light'
),
)
fig.show()
See the second
fig.add_trace
, I have asked the star symbol to be blue, but it will just plot grey.
Now, if I change the symbol from the first
fig.add_trace
from circles to triangles, not only those triangles cease to be blue, but also only a small part of the original circle symbols got plotted.
I am not sure if there is some bug or if I am doing something wrong? I am running plotly 5.8.0 with Python 3.9.
Thanks for your help.