-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_visulization.py
37 lines (31 loc) · 901 Bytes
/
map_visulization.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import plotly.graph_objects as go
import pandas as pd
coord = pd.read_csv('./yelp_dataset/coord.csv')
# coord['is_open'] = coord['is_open'].values * 255
scl = [0,"rgb(255,0,0)"], [1,"rgb(0, 0, 255)"]
mapbox_access_token = 'pk.eyJ1IjoieXV4aWFuZ2dvbmciLCJhIjoiY2p6M2I1ejJnMDFsNjNjcXRpdmw4cjAweCJ9.ecfVq0S-fu56dHr50J2YwQ'
fig = go.Figure(go.Scattermapbox(
lat=coord['latitude'],
lon=coord['longitude'],
mode='markers',
marker=go.scattermapbox.Marker(
size=9,
color = coord['is_open'],
colorscale = scl
),
))
fig.update_layout(
autosize=True,
hovermode='closest',
mapbox=go.layout.Mapbox(
accesstoken=mapbox_access_token,
bearing=0,
center=go.layout.mapbox.Center(
lat=40.436447,
lon=-79.922706,
),
pitch=0,
zoom=10
),
)
fig.show()