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

Scattermapbox some texts only appear when I zoom


I have problem with plotly.graph_objs.Scattermapbox(mode='markers+text', ...) in Python. (I can’t use the default maps, because I need a detailed map of Germany, so I decided to use mapbox)

Basically it works well, but the problem is, some of the text only appear, when I zoom the map enough. I guess it happens to avoid the text overlapped with the marker or other text.

My texts are the city names, and I want this city names to be always visible, without zooming, even if it overlaps with the markers. (And each map has different data to show, i.e. different city names should be shown)

I looked through the full reference, but I couldn’t find a way to fix my problem.

Maybe I could use annotation in plotly.graph_objs.Layout(annotations=...), instead of plotly.graph_objs.Scattermapbox(mode='markers+text', ...), but I am not sure if I can use geo-coordinates(lat, lon) to position the annotations… Probably not. Since I am planning to generate 150+ maps, so manually doing it is not preferable.

Thank you!!

1 Like