#plotly #mapbox
#сюжетно #картографический ящик
Вопрос:
как изменить язык на карте на местный язык, как на карте Google. например, если это в Японии, покажите японский, если это в Китае, покажите китайский.
полный код:
import plotly.graph_objects as go import plotly.io as pio import plotly import pandas as pd lon1 = [113.076843, 113.154191, 113.737213, 113.842405, 114.244183 ] lat1 = [23.10993, 23.218533, 23.047626, 22.987975, 22.601581 ] node1 = ["1","2","3","4","5"] lon2 = [113.364738, 113.664108, 113.661705,114.244183] lat2 = [22.997112, 22.878038, 22.869216, 22.601581] node2 = ["6",'7','8','5'] mapbox_access_token = 'your token' df = pd.DataFrame({'name': node1, 'latitude': lat1, 'longitude': lon1}) df2 = pd.DataFrame({'name': node2, 'latitude': lat2, 'longitude': lon2}) lon_trip1 = lon1 lat_trip1 = lat1 lon_trip2 = lon2 lat_trip2 = lat2 fig = go.Figure() fig.add_trace(go.Scattermapbox( lat=list(df['latitude']), lon=list(df['longitude']), mode="markers lines text", name="trip1", marker=dict(size=10), textposition='middle center', textfont=dict(size=7, color='white'), text=[df['name'][i] for i in range(df.shape[0])] )) fig.add_trace( go.Scattermapbox( lat=list(df2['latitude']), lon=list(df2['longitude']), mode="markers lines text", name="trip2", marker=dict(size=10), textposition='middle center', textfont=dict(size=7, color='white'), text=[df2['name'][i] for i in range(df2.shape[0])] )) # fig.update_layout( # margin={'l': 113, 't': 24, 'b': 22, 'r': 115}, # mapbox=dict(style='carto-positron', # center=go.layout.mapbox.Center(lon=113.664, lat=22.878), # pitch=0, # zoom=8) # ) fig.update_layout( dict(margin=dict(l=113, t=24, r=115, b=22), mapbox=dict(accesstoken=mapbox_access_token, center=dict(lat=22.878, lon=113.664), style='light', zoom=8)) ) fig.show(id='the_graph', config= {'displaylogo': False})