Display text in Mapbox

Is it possible to display only text or numbers instead of symbols in mapbox if yes can someone guide me please

Something like this

@rasika

Yes it is possible to display such values at your lon and lat given in Scattermapbox. Namely, you
define mode=β€˜text’ , and text =[20, 21, 16, 15.....] is the list of values . In this case each number (or string if you define text as a list of strings) is displayed on the map. Moreover on hover you’ll see the lon and lat, as well as the corresponding string in text.

If you want to change what is displaying on hover, just define hovertext as a list of strings as follows:
hovertext =['aaaa<br>12', 'bbbb<br>18', .....]
and set hoverinfo='text'.

Thank you, this works, i tried setting up color of text with this color=list(map(SetColors, my_gr['value'])) but it is not working, throwing the following error Invalid value of type 'builtins.list' received for the 'color' property of scattermapbox.textfont … am i missing something here?

@rasika To express my opinion I should know how is defined SetColors, what is my_gr['value']. Is your intention to define color as a list of valulist of color codes? Please be more precise when you address questions.

sorry, if i am not clear, i want to color the text based on the value and SetColors is the function i have written which will return the colorlist.

If I don’t see how SetColors is defined and my_gr['value'], I cannot figure out what is wrong.

Here is the function
def SetColors(x): if x== 'ra': return "purple" elif x== 'ew': return "pink" elif x== 'as': return "orange" elif x== 'rea': return "white" elif x== 'cad': return "red" elif x== 'reaa': return "brown" elif x== 'asx': return "yellow" elif x== 'ewm': return "black" elif x== 'awac': return "green"

Here is the trace, i am pulling the values from a dataframe

fig.add_trace(go.Scattermapbox(lon=my_gr['longitude'], lat=my_gr['latitude'], customdata=my_gr['value'], hovertemplate='<b>SL</b>: %{customdata},%{lat},%{lon}', name=gr, mode='text', text=my_gr['number'], textfont=dict(family="sans serif",size=18,color=list(map(SetColors, my_gr['value'])))))

here is the error i get
Invalid value of type 'builtins.list' received for the 'color' property of scattermapbox.textfont

@rasika
textfont_color cannot be a list of colors, but just a color name or code.

How can i pick a single value from dataframe and map it to the required color

@empet how can i make it to pick only one color instead of list. Thanks for your help