[Solved] Symbol changes not showing up with Scattermapbox


#1

Does anyone experience the same?

I have been plotting location on a map using go.Scattermapbox. Everything works perfectly fine except the Scatter points are vanishing if I change their shape using ‘symbol’.

Weird fact, the change does appear in the legend but is not being plotted. I tried with different symbol (diamond, cross, etc…)

indent preformatted text by 4 spaces

data = go.Scattermapbox(
        lon = df.LON,
        lat = df.LAT,
        mode = 'markers',
        marker=dict(size=15,
                    color= 'red',
                    opacity = 0.7)

This piece of code does make all points appearing.

data = go.Scattermapbox(
        lon = df.LON,
        lat = df.LAT,
        mode = 'markers',
        marker=dict(size=15,
                    symbol = 'diamond'
                    color= 'red',
                    opacity = 0.7)

and is this one, the points are ‘disappearing’.

Many thanks for your time and reply guys !

PS : I tried on Jupyter Notebook + Dash App on local host. Both did not work.


#2

Hi @qdumont,

The trouble you’re running into is that marker symbols for the scattermapbox trace work a bit differently than scatter traces because the marker rendering is actually performed by the Mapbox library. Here’s the docstring for the scattermapbox.marker.symbol property.

Sets the marker symbol. Full list: https://www.mapbox.com/maki-
icons/ Note that the array `marker.color` and `marker.size` are
only available for "circle" symbols.

If you visit https://www.mapbox.com/maki-icons/ you can hover over the icons to see the name of each symbol. The name you specify should include everything up until the hyphen. For example, if you hover over an air plain icon and the tooltip says that it’s called airfield-11.svg, you use 'airfield' as the symbol.

Hope that helps!
-Jon


#3

Hi @jmmease,

Thanks a lot for the explanation and the solution. I see how it will work. For the moment I moved to another part of the Dashboard but will update and provide the code when I will have changed it.

Many thanks,

Quentin.