Python數(shù)據(jù)可視化之基于pyecharts實(shí)現(xiàn)的地理圖表的繪制
一、例子:百度遷徙
百度地圖春節(jié)人口遷徙大數(shù)據(jù)(簡(jiǎn)稱(chēng)百度遷徙),是百度在2014年春運(yùn)期間推出的一項(xiàng)技術(shù)項(xiàng)目。百度遷徙利用大數(shù)據(jù),對(duì)其擁有的LBS(基于地理位置的服務(wù))大數(shù)據(jù)進(jìn)行計(jì)算分析,采用的可視化呈現(xiàn)方式,動(dòng)態(tài)、即時(shí)、直觀地展現(xiàn)中國(guó)春節(jié)前后人口大遷徙的軌跡與特征。
網(wǎng)址:https://qianxi.baidu.com/2021/

二、基礎(chǔ)語(yǔ)法介紹
|
語(yǔ)法 |
說(shuō)明 |
| from pyecharts.charts import Geo | 導(dǎo)入地圖庫(kù) |
| Geo() | Pyecharts地理圖表繪制 |
| .add_map(maptype=“china“) | 地圖類(lèi)型 |
| .add() | 添加數(shù)據(jù) |
| .set_global_opts() | 設(shè)置全局配置項(xiàng) |
三、中國(guó)地圖繪制
實(shí)例代碼:
from pyecharts.charts import Geo
import pyecharts.options as opts
from commons import Faker
(
Geo()
.add_schema(maptype='china') # 使用中國(guó)地圖的類(lèi)型
.add(series_name='', data_pair=[(i, j) for i, j in zip(Faker.provinces, Faker.values())])
.set_global_opts(
title_opts=opts.TitleOpts(title='中國(guó)地圖'),
visualmap_opts=opts.VisualMapOpts(
# is_piecewise=True # 非連續(xù)型顯示
)
)
).render()
運(yùn)行結(jié)果:

四、中國(guó)地圖(特效散點(diǎn)圖)
實(shí)例代碼:
from pyecharts.charts import Geo
import pyecharts.options as opts
from pyecharts.globals import ChartType
from commons import Faker
(
Geo()
.add_schema(maptype='china') # 使用中國(guó)地圖的類(lèi)型
.add(series_name='', data_pair=[(i, j) for i, j in zip(Faker.provinces, Faker.values())],
type_=ChartType.EFFECT_SCATTER)
.set_global_opts(
title_opts=opts.TitleOpts(title='中國(guó)地圖(特效散點(diǎn)圖)'),
visualmap_opts=opts.VisualMapOpts(
is_piecewise=True
)
)
).render()
運(yùn)行結(jié)果:

五、中國(guó)人口地理遷徙圖繪制
實(shí)例代碼:
from pyecharts.charts import Geo
from pyecharts.globals import ChartType, SymbolType
import pyecharts.options as opts
# 數(shù)據(jù)構(gòu)建(元組形式)
city_num = [('廣州', 105), ('成都', 70), ('北京', 99), ('西安', 80)]
start_end = [('廣州', '成都'), ('廣州', '北京'), ('廣州', '西安')]
(
Geo()
.add_schema(maptype='china', itemstyle_opts=opts.ItemStyleOpts(color='#323c48', border_color='#111')) # 地圖形式設(shè)置
.add('', data_pair=city_num, color='white') # 地圖數(shù)據(jù)顏色設(shè)置(點(diǎn))
.add('', data_pair=start_end, type_=ChartType.LINES, # 設(shè)置線
effect_opts=opts.EffectOpts(symbol=SymbolType.ARROW,color='blue', symbol_size=7)) # 流動(dòng)箭頭繪制
).render()
運(yùn)行結(jié)果:

六、熱力圖:廣東地圖熱力圖繪制1
實(shí)例代碼:
from pyecharts.faker import Faker
from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.globals import ChartType
c = (
Geo()
.add_schema(maptype="廣東", itemstyle_opts=opts.ItemStyleOpts(color="#323c48", border_color="#111"),)
.add("",[list(z) for z in zip(Faker.guangdong_city, Faker.values())],type_=ChartType.HEATMAP)
.set_global_opts(
visualmap_opts=opts.VisualMapOpts(),
title_opts=opts.TitleOpts(title="廣東地圖熱力圖"),
)
)
c.render()
運(yùn)行結(jié)果:

七、熱力圖:廣東地圖熱力圖繪制2
實(shí)例代碼:
from pyecharts.charts import Map
from pyecharts import options as opts
from pyecharts.globals import ChartType
c = (
Map()
.add('', [list(z) for z in zip(Faker.guangdong_city, Faker.values())], "廣東")
.set_global_opts(
title_opts=opts.TitleOpts(title="Map-廣東地圖"),
visualmap_opts=opts.VisualMapOpts(),
)
)
c.render()
運(yùn)行結(jié)果:

到此這篇關(guān)于Python數(shù)據(jù)可視化之基于pyecharts實(shí)現(xiàn)的地理圖表的繪制的文章就介紹到這了,更多相關(guān)pyecharts繪制地理圖表內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- Python數(shù)據(jù)可視化 pyecharts實(shí)現(xiàn)各種統(tǒng)計(jì)圖表過(guò)程詳解
- python的pyecharts繪制各種圖表詳細(xì)(附代碼)
- 一文教你用Pyecharts做交互圖表
- Python+pyecharts繪制交互式可視化圖表
- 詳解如何基于Pyecharts繪制常見(jiàn)的直角坐標(biāo)系圖表
- Python使用pyecharts控件繪制圖表
- 教你用pyecharts繪制各種圖表案例(效果+代碼)
- Python繪制地理圖表可視化神器pyecharts
- Python可視化神器pyecharts繪制地理圖表
- Python可視化神器pyecharts之繪制地理圖表練習(xí)
- Pyecharts之特殊圖表的實(shí)現(xiàn)示例
相關(guān)文章
python+django+selenium搭建簡(jiǎn)易自動(dòng)化測(cè)試
這篇文章主要介紹了python+django+selenium搭建簡(jiǎn)易自動(dòng)化測(cè)試,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-08-08
django為Form生成的label標(biāo)簽添加class方式
這篇文章主要介紹了django為Form生成的label標(biāo)簽添加class方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-05-05
淺談python3發(fā)送post請(qǐng)求參數(shù)為空的情況
今天小編就為大家分享一篇淺談python3發(fā)送post請(qǐng)求參數(shù)為空的情況,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-12-12
linux上運(yùn)行python腳本,SyntaxError:?invalid?syntax的解決
這篇文章主要介紹了linux上運(yùn)行python腳本,SyntaxError:?invalid?syntax的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-12-12
python實(shí)現(xiàn)列表中由數(shù)值查到索引的方法
今天小編就為大家分享一篇python實(shí)現(xiàn)列表中由數(shù)值查到索引的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-06-06
Python標(biāo)準(zhǔn)庫(kù)筆記struct模塊的使用
這篇文章主要介紹了Python標(biāo)準(zhǔn)庫(kù)筆記struct模塊的使用,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-02-02
Pyside2中嵌入Matplotlib的繪圖的實(shí)現(xiàn)
這篇文章主要介紹了Pyside2中嵌入Matplotlib的繪圖的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02

