Skip to content

Commit efe5f07

Browse files
authored
Upload the .py file the codes to build the map
1 parent b4403ee commit efe5f07

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

choropleth-map.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
5+
import pandas as pd
6+
import numpy as np
7+
import plotly
8+
import plotly.graph_objs as go
9+
import json
10+
from datetime import datetime
11+
12+
geo = pd.read_csv('Geography.csv');
13+
14+
with open('./maps/china/china_geojson.json') as file:
15+
china = json.load(file)
16+
17+
18+
19+
fig = go.Figure(go.Choroplethmapbox(geojson=china,locations=geo.Regions,z=geo.followerPercentage,
20+
colorscale='Cividis',zmin=0,zmax=17,
21+
marker_opacity=0.5, marker_line_width=0))
22+
fig.update_layout(mapbox_style="carto-positron",
23+
mapbox_zoom=3, mapbox_center = {"lat": 35.8617, "lon": 104.1954})
24+
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
25+
fig.show()
26+
27+
28+
29+
30+

0 commit comments

Comments
 (0)