fig = px.scatter_mapbox(data_frame=dff29, lat=“latid”, lon=“long”, center={“lat”: 60, “lon”: 10},
width=800, height=800, zoom=5, hover_name=“Name”, hover_data=[“Name”, “latid”, “long”],
color_discrete_sequence=[“fuchsia”],
title=‘Målepunkter veiobjekter 2021’
)
fig.update_layout(mapbox_style=“dark”, mapbox_accesstoken=AccessToken)
fig.update_layout(mapbox_style=“open-street-map”)
fig.show()
Any Idea??? my work is stopped, would be very greatfull for a response and help, thanks
Are you using native language in your code? I think you need to check again the double quotation (mark) of latitude and longitude, the center of latitude and longitude, the title, and the specification of hover data.
Yes, i am using native language, but no effect if i use english
single and double quitation are testet and there were no effect.
thank for your response
Double quotation marks, etc. have been corrected to English standards. And since there is no data presented, I modified the code using data from the official reference. Added color and marker size settings. Please check the data by replacing them with yours.
import plotly.express as px
import numpy as np
AccessToken = open("mapbox_api_key.txt").read()
df = px.data.carshare()
fig = px.scatter_mapbox(df,
lat="centroid_lat",
lon="centroid_lon",
center={"lat": np.mean(df['centroid_lat']), "lon": np.mean(df['centroid_lon'])},
width=800,
height=800,
zoom=10,
#hover_name="Name",
hover_data=["centroid_lat", "centroid_lon", "peak_hour"],
color_discrete_sequence="fuchsia",
title="Målepunkter veiobjekter 2021",
color="peak_hour",
size="car_hours",
)
fig.update_layout(mapbox_style="dark", mapbox_accesstoken=AccessToken)
fig.update_layout(mapbox_style="open-street-map")
fig.show()
Thank you for your response,
after a more detailed review yesterday, I found the fault in my data, one of latitude points had an incorrect format (it was 585638.2 instead of 58.56382).
I will write a new BUG report about it for Dash community.
thank again