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

Scattermapbox - marker symbol location pin

Hi Team,

I am trying plot a map in which I want the co-ordinates to displayed as a replica of google map
How do change the default symbol from circle to location pin. Can you please provide an example of the symbol = “location pin”

Hi @ashti,

Welcome to forum! The mapbox symbol for ‘location pin’ is symbol ='marker', but the marker_color='red', for example, has no effect. Mapbox ‘marker’ is 'black by default.


mapboxt = open(".mapbox_token").read().rstrip() #my mapbox_access_token 
lats = [52.370216, 53.2191696,  50.851368, 51.8125626]
lons = [4.895168,  6.5666699, 5.690973, 5.8372264 ]
scatt = go.Scattermapbox(
            hovertext=['Amsterdam', 'Groningen',  'Maastricht', 'Nijmegen'],  
            marker=dict(symbol ='marker', size=15, color='blue'))
layout = go.Layout(title_text ='Pin location at a few cities in Netherlands', 
                   title_x =0.5, width=750, height=700,
                   mapbox = dict(center= dict(lat=52.370216, lon=4.895168),            
                                 accesstoken= mapboxt,

fig=go.Figure(data=[ scatt], layout =layout)

For more symbols see this discussion: Scattermapbox marker with no fill

Thank you for this. Can we change the location color pin to red instead of black…

There are other marker options as well which can be seen in :
marker-15.svg,marker-stroked.svg. Whats the right syntax to use them in the code…I am assuming 11 and 15 are the size properties

  1. No, unfortunately we can’t change the color.

  2. The marker size displayed in the maki table must be omitted when you define symbol ='some-icon'


I realized that it is possible to define custom location pins, but not as svg paths. I defined them here as mapbox layers ( from geojson sources.