# 1. 準數(shù)據(jù)
### 山東省
sd_c = ['青島市','濟南市','濰坊市','臨沂市','煙臺市','聊城市','濟寧市','淄博市','菏澤市','德州市','泰安市','濱州市','威海市','東營市','棗莊市','日照市']
sd_d = [1278,1163,834,704,673,632,622,587,586,570,434,401,303,289,216,201]
### 廣東省
gd_c = ['廣州市','東莞市','佛山市','汕頭市','惠州市','中山市','揭陽市','珠海市','江門市','潮州市','湛江市','清遠市','汕尾市','肇慶市','茂名市','梅州市','韶關(guān)市','河源市','陽江市','云浮市']
gd_d = [1925,1235,936,788,548,464,420,356,354,311,274,246,237,220,205,157,127,118,108,82]
### 四川省
sc_c = ['綿陽市','南充市','廣元市','德陽市','宜賓市','達州市','瀘州市','廣安市','樂山市','遂寧市','眉山市','巴中市','涼山彝族自治州','內(nèi)江市','自貢市','資陽市','雅安市','攀枝花市','阿壩藏族羌族自治州','甘孜藏族自治州']
sc_d = [944,741,639,555,493,463,359,351,340,337,300,282,239,214,190,174,157,141,123,104]
### 浙江省
zj_c = ['杭州市','溫州市','寧波市','金華市','嘉興市','臺州市','紹興市','湖州市','麗水市','衢州市','舟山市']
zj_d = [1183,792,765,582,438,381,360,288,197,103,66]
### 貴州省
gz_c = ['貴陽市','遵義市','畢節(jié)市','黔南布依族苗族自治州','黔西南布依族苗族自治州','六盤水市','安順市','黔東南苗族侗族自治州','銅仁市']
gz_d = [1605,887,454,414,414,381,338,291,196]
其init_opts=opts.InitOpts(width="700px",height="300px",theme="blue")這部分代碼是自定義的,不需要的可以去掉(這里只是修改了默認從參數(shù))
add中:add('', [(i,j) for i,j in zip(sd_c,sd_d)], '山東'),其中sd_c是省份對應的市,sd_d是每一個市對應的火鍋店數(shù),后面的“山東”是省份,sd_c的市是和和山東對應的
# 2. 繪制山東省地圖:格式一
map1 = (
Map(init_opts=opts.InitOpts(width="700px",height="300px",theme="blue"))
.add('', [(i,j) for i,j in zip(sd_c,sd_d)], '山東')
.set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=4000))
)
# 3. 繪制廣東省地圖:格式二
map2 = (
Map()
.add('', [(i,j) for i,j in zip(gd_c,gd_d)], '廣東')
.set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=400,is_piecewise=True))
)
# 4. 繪制四川省地圖:格式二
map3 = (
Map()
.add('', [(i,j) for i,j in zip(sc_c,sc_d)], '四川')
.set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=400,is_piecewise=True))
)
# 5. 繪制浙江省地圖:格式二
map4 = (
Map()
.add('', [(i,j) for i,j in zip(zj_c,zj_d)], '浙江')
.set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=400,is_piecewise=True))
)
# 6. 繪制貴州省地圖:格式二
map5 = (
Map()
.add('', [(i,j) for i,j in zip(gz_c,gz_d)], '貴州')
.set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=400,is_piecewise=True))
)