1

I want to display some points (longitude, latitude) on a map of Taiwan using plotly library. The problem is where can I find such a map of Taiwan and load it and is there some sample?

1

1 Answer 1

1

Hi I have created tutorials for problems like this, you can access it on: https://github.com/SayaliSonawane/Plotly_Offline_Python/tree/master/Satellite%20Map

You can use satellite map in outdoor style to create this type of plot:

import plotly
import pandas as pd
from plotly.graph_objs import Scattermapbox,Data,Layout

# Open mapbox account and pass your access token over here
# Mapbox account sign up and access token is free. 
# Mapbox information: https://www.mapbox.com/help/how-access-tokens-work/#rotating-tokens

mapbox_access_token = 'Enter_your_access_token'
data = Data([Scattermapbox(
        lat= dataframe_name['Latitude'],
        lon= dataframe_name['Longitude'],
        # text: provide column which will display hover information
        text = [str(n) for n in dataframe_name['ADR_Line_2']],
        mode='markers',
        marker = dict(color = 'rgb(0, 128, 0)',size=10),  
        hoverinfo='skip'
    ) ]) 



layout = Layout(
        title = "title_for_plot",
        font=dict(family='Courier New, monospace', size=18, color='rgb(0,0,0)'),
        autosize=False,
        hovermode='closest',
        showlegend=False,
        width=1800,
        height=1000,
        mapbox=dict(
            accesstoken=mapbox_access_token,
            #width=1415,
            bearing=0,
            pitch=0,
            style = 'outdoors'
        ),
    )                    

plotly.offline.plot({"data":data, "layout":layout},filename = 'taiwan_map.html')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.