python怎么画地图
【摘要】安装所需包——pyecharts。两种安装方式:1、pip install pyecharts;2、从JetBrains PyCharm中 File——>Settings ——>Project——

安装所需包——pyecharts。
两种安装方式:
1、pip install pyecharts;
2、从JetBrains PyCharm中 File——>Settings...——>Project——>Project Interpreter 点击右上角的绿色“+”,在搜索框中输入“pyecharts”,点击安装即可(个人习惯用第二种)。
相关推荐:《Python教程》
地图文件安装
进入pyecharts官网,下载并安装所需地图软件——echarts-china-counties-pypkg
绘制县级地图,代码如下:
/*
from pyecharts import Map, Page, Styledef create_charts():
page = Page()
style = Style(width=1100, height=600)
data = [('赫章县', 7.62), ('纳雍县', 11.43), ('黔西县', 14.29), ('织金县', 9.52), ('大方县', 15.24),('金沙县', 18.10),
('七星关区', 0.95), ('威宁彝族回族苗族自治县', 11.43)]
chart = Map("毕节地理坐标系", **style.init_style)
attr, value = chart.cast(data)
chart.add("", attr, value, maptype='毕节',
is_visualmap=True, visual_type='color',
is_label_show=True, label_formatter='{b}n{c}',
is_area_show=False,# 组件条距离左侧的位置
visual_pos='right',# 组件放置方向
('vertical', 'horizontal')
visual_orient='horizontal',# 组件映射范围
visual_range=[0, 20],visual_text_color='#000')
page.add(chart)
return page
create_charts().render('render2.html') #如果想保存到指定路径:create_charts()
.render('C:UsersSYHDesktoprender2.html')
*/
修改成你自己的县级地图
修改代码中的maptype='毕节' 为你需要的地市,并在data中修改对应县名称及数据。名称参照官网。
上一篇:python入门基础教程
下一篇:python如何绘图
就业培训申请领取


环球青藤
官方QQ群扫描上方二维码或点击一键加群,免费领取大礼包,加群暗号:青藤。 一键加群
最新文章
Python编程各地入口
环球青藤官方微信服务平台


刷题看课 APP下载
免费直播 一键购课
代报名等人工服务
Python编程热点排行