Hello, I am trying to put text on the regions of Mexico in my map. I have a Choroplethmapbox and I am adding Scattermapbox on top of it with the text. I want the text to be a static size so that when I zoom out it becomes smaller and when I zoom in it doesnt change, but currently, the text appears and dissapears based on how I zoom and pan the map. So I would just like to know how I can set this text so that it does not change at all. Thank you.
This is a section of the code that I have which builds the graph objects:
data = [go.Choroplethmapbox(geojson=mx_regions_geo, ids=dff['State'], z=dff[y_type],
locations=dff['State'], featureidkey='properties.name', colorscale='reds',
marker=dict(line=dict(color='black'), opacity=0.6),
zmin = 0, zmax = zmax_
),
go.Scattermapbox(
# hoverinfo=gdff['Revenue'],
lat = gdff['lat'],lon = gdff['lon'],
text = gdff['Revenue'],
textfont= {'color':'black','size':15,'family':'Courier New'},
mode = 'text',
name = 'Revenue',
),
]
layout = go.Layout(
autosize=True,
mapbox={
'accesstoken': mapboxtoken,
'style': mapboxstyle,
'zoom': 4,
'center': {'lat': 25, 'lon': -99}},
margin={"r": 0, "t": 0, "l": 0, "b": 0},
height=700,
)
return dcc.Graph(figure={'data': data, 'layout': layout})
Here is a picture of my map currently:
As you can see, only 2 of my text labels show up. I just want it to all appear regardless of how I zoom or pan my map. Thank you. Maybe there is a better way not using Scattermapbox, If there is please let me know.