Python可视化神器pyecharts之绘制地理图表练习


Posted in Python onJuly 07, 2022

炫酷地图

前期我们介绍了很多的地图模板,不管是全球的还是中国的,其实我感觉都十分的炫酷,哈哈哈,可是还有更加神奇的,更加炫酷的地图模板,下面让我们一起一饱眼福吧!

3D炫酷地图模板系列

重庆市3D地图展示

from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.globals import ChartType
# 经纬度
example_data = [
[[119.107078, 36.70925, 1000], [116.587245, 35.415393, 1000]],
[[117.000923, 36.675807], [120.355173, 36.082982]],
[[118.047648, 36.814939], [118.66471, 37.434564]],
[[121.391382, 37.539297], [119.107078, 36.70925]],
[[116.587245, 35.415393], [122.116394, 37.509691]],
[[119.461208, 35.428588], [118.326443, 35.065282]],
[[116.307428, 37.453968], [115.469381, 35.246531]],
]
c = (
Map3D(init_opts=opts.InitOpts(width="1400px", height="700px"))
.add_schema(
maptype="重庆",
itemstyle_opts=opts.ItemStyleOpts(
color="rgb(5,101,123)",
opacity=1,
border_width=0.8,
border_color="rgb(62,215,213)",
),
light_opts=opts.Map3DLightOpts(
main_color="#fff",
main_intensity=1.2,
is_main_shadow=False,
main_alpha=55,
main_beta=10,
ambient_intensity=0.3,
),
view_control_opts=opts.Map3DViewControlOpts(center=[-10, 0, 10]),
post_effect_opts=opts.Map3DPostEffectOpts(is_enable=False),
)
.add(
series_name="",
data_pair=example_data,
type_=ChartType.LINES3D,
effect=opts.Lines3DEffectOpts(
is_show=True,
period=4,
trail_width=3,
trail_length=0.5,
trail_color="#f00",
trail_opacity=1,
),
linestyle_opts=opts.LineStyleOpts(is_show=False, color="#fff", opacity=0),
)
.set_global_opts(title_opts=opts.TitleOpts(title="Map3D"))
.render("区县3D地图.html")
)

Python可视化神器pyecharts之绘制地理图表练习

中国3D地图

数组里面分别代表:经纬度,数值

from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.globals import ChartType
from pyecharts.commons.utils import JsCode
example_data = [
("黑龙江", [127.9688, 45.368, 100]),
("内蒙古", [110.3467, 41.4899, 100]),
("吉林", [125.8154, 44.2584, 100]),
("辽宁", [123.1238, 42.1216, 100]),
("河北", [114.4995, 38.1006, 100]),
("天津", [117.4219, 39.4189, 100]),
("山西", [112.3352, 37.9413, 100]),
("陕西", [109.1162, 34.2004, 100]),
("甘肃", [103.5901, 36.3043, 100]),
("宁夏", [106.3586, 38.1775, 100]),
("青海", [101.4038, 36.8207, 100]),
("新疆", [87.9236, 43.5883, 100]),
("西藏", [91.11, 29.97, 100]),
("四川", [103.9526, 30.7617, 100]),
("重庆", [108.384366, 30.439702, 100]),
("山东", [117.1582, 36.8701, 100]),
("河南", [113.4668, 34.6234, 100]),
("江苏", [118.8062, 31.9208, 100]),
("安徽", [117.29, 32.0581, 100]),
("湖北", [114.3896, 30.6628, 100]),
("浙江", [119.5313, 29.8773, 100]),
("福建", [119.4543, 25.9222, 100]),
("江西", [116.0046, 28.6633, 100]),
("湖南", [113.0823, 28.2568, 100]),
("贵州", [106.6992, 26.7682, 100]),
("广西", [108.479, 23.1152, 100]),
("海南", [110.3893, 19.8516, 100]),
("上海", [121.4648, 31.2891, 100]),
]
c = (
Map3D(init_opts=opts.InitOpts(width="1400px", height="700px"))
.add_schema(
itemstyle_opts=opts.ItemStyleOpts(
color="rgb(5,101,123)",
opacity=1,
border_width=0.8,
border_color="rgb(62,215,213)",
),
map3d_label=opts.Map3DLabelOpts(
is_show=False,
formatter=JsCode("function(data){return data.name + " " + data.value[2];}"),
),
emphasis_label_opts=opts.LabelOpts(
is_show=False,
color="#fff",
font_size=10,
background_color="rgba(0,23,11,0)",
),
light_opts=opts.Map3DLightOpts(
main_color="#fff",
main_intensity=1.2,
main_shadow_quality="high",
is_main_shadow=False,
main_beta=10,
ambient_intensity=0.3,
),
)
.add(
series_name="Scatter3D",
data_pair=example_data,
type_=ChartType.SCATTER3D,
bar_size=1,
shading="lambert",
label_opts=opts.LabelOpts(
is_show=False,
formatter=JsCode("function(data){return data.name + ' ' + data.value[2];}"),
),
)
.set_global_opts(title_opts=opts.TitleOpts(title="Map3D"))
.render("中国3D地图.html")
)

Python可视化神器pyecharts之绘制地理图表练习

中国3D数据地图(适合做数据可视化)

如果说前面的那个你看起来不太舒服,那么这个绝对适合做数据可视化展示哟!

from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.globals import ChartType
from pyecharts.commons.utils import JsCode
example_data = [
("黑龙江", [127.9688, 45.368, 100]),
("内蒙古", [110.3467, 41.4899, 300]),
("吉林", [125.8154, 44.2584, 300]),
("辽宁", [123.1238, 42.1216, 300]),
("河北", [114.4995, 38.1006, 300]),
("天津", [117.4219, 39.4189, 300]),
("山西", [112.3352, 37.9413, 300]),
("陕西", [109.1162, 34.2004, 300]),
("甘肃", [103.5901, 36.3043, 300]),
("宁夏", [106.3586, 38.1775, 300]),
("青海", [101.4038, 36.8207, 300]),
("新疆", [87.9236, 43.5883, 300]),
("西藏", [91.11, 29.97, 300]),
("四川", [103.9526, 30.7617, 300]),
("重庆", [108.384366, 30.439702, 300]),
("山东", [117.1582, 36.8701, 300]),
("河南", [113.4668, 34.6234, 300]),
("江苏", [118.8062, 31.9208, 300]),
("安徽", [117.29, 32.0581, 300]),
("湖北", [114.3896, 30.6628, 300]),
("浙江", [119.5313, 29.8773, 300]),
("福建", [119.4543, 25.9222, 300]),
("江西", [116.0046, 28.6633, 300]),
("湖南", [113.0823, 28.2568, 300]),
("贵州", [106.6992, 26.7682, 300]),
("广西", [108.479, 23.1152, 300]),
("海南", [110.3893, 19.8516, 300]),
("上海", [121.4648, 31.2891, 1300]),
]
c = (
Map3D(init_opts=opts.InitOpts(width="1400px", height="700px"))
.add_schema(
itemstyle_opts=opts.ItemStyleOpts(
color="rgb(5,101,123)",
opacity=1,
border_width=0.8,
border_color="rgb(62,215,213)",
),
map3d_label=opts.Map3DLabelOpts(
is_show=False,
formatter=JsCode("function(data){return data.name + " " + data.value[2];}"),
),
emphasis_label_opts=opts.LabelOpts(
is_show=False,
color="#fff",
font_size=10,
background_color="rgba(0,23,11,0)",
),
light_opts=opts.Map3DLightOpts(
main_color="#fff",
main_intensity=1.2,
main_shadow_quality="high",
is_main_shadow=False,
main_beta=10,
ambient_intensity=0.3,
),
)
.add(
series_name="数据",
data_pair=example_data,
type_=ChartType.BAR3D,
bar_size=1,
shading="lambert",
label_opts=opts.LabelOpts(
is_show=False,
formatter=JsCode("function(data){return data.name + ' ' + data.value[2];}"),
),
)
.set_global_opts(title_opts=opts.TitleOpts(title="城市数据"))
.render("带有数据展示地图.html")
)

Python可视化神器pyecharts之绘制地理图表练习

看完直呼这个模板,适合做城市之间的数据对,同时也展示了经纬度。

全国行政区地图(带城市名字)

from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.globals import ChartType

c = (
Map3D(init_opts=opts.InitOpts(width="1400px", height="700px"))
.add_schema(
itemstyle_opts=opts.ItemStyleOpts(
color="rgb(5,101,123)",
opacity=1,
border_width=0.8,
border_color="rgb(62,215,213)",
),
map3d_label=opts.Map3DLabelOpts(
is_show=True,
text_style=opts.TextStyleOpts(
color="#fff", font_size=16, background_color="rgba(0,0,0,0)"
),
),
emphasis_label_opts=opts.LabelOpts(is_show=True),
light_opts=opts.Map3DLightOpts(
main_color="#fff",
main_intensity=1.2,
is_main_shadow=False,
main_alpha=55,
main_beta=10,
ambient_intensity=0.3,
),
)
.add(series_name="", data_pair="", maptype=ChartType.MAP3D)
.set_global_opts(
title_opts=opts.TitleOpts(title="全国行政区划地图-Base"),
visualmap_opts=opts.VisualMapOpts(is_show=False),
tooltip_opts=opts.TooltipOpts(is_show=True),
)
.render("全国标签地图.html")
)

Python可视化神器pyecharts之绘制地理图表练习

地球展示

import pyecharts.options as opts
from pyecharts.charts import MapGlobe
from pyecharts.faker import POPULATION
data = [x for _, x in POPULATION[1:]]
low, high = min(data), max(data)
c = (
MapGlobe(init_opts=opts.InitOpts(width="1400px", height="700px"))
.add_schema()
.add(
maptype="world",
series_name="World Population",
data_pair=POPULATION[1:],
is_map_symbol_show=False,
label_opts=opts.LabelOpts(is_show=False),
)
.set_global_opts(
visualmap_opts=opts.VisualMapOpts(
min_=low,
max_=high,
range_text=["max", "min"],
is_calculable=True,
range_color=["lightskyblue", "yellow", "orangered"],
)
)
.render("地球.html")
)

Python可视化神器pyecharts之绘制地理图表练习

其实pyecharts还可以做百度地图,可以缩放定位到每一个区域,但是其实我们在日常生活中可能用不上,如果要用可以去百度地图展示效果或者学习练习也是可的

到此这篇关于Python可视化神器pyecharts之绘制地理图表的文章就介绍到这了,更多相关Python绘制地理图表内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!


Tags in this post...

Python 相关文章推荐
Python实现爬取知乎神回复简单爬虫代码分享
Jan 04 Python
Python统计文件中去重后uuid个数的方法
Jul 30 Python
Python 异常处理的实例详解
Sep 11 Python
tensorflow 输出权重到csv或txt的实例
Jun 14 Python
python设定并获取socket超时时间的方法
Jan 12 Python
Python面向对象程序设计类的多态用法详解
Apr 12 Python
django框架防止XSS注入的方法分析
Jun 21 Python
Python 开发工具PyCharm安装教程图文详解(新手必看)
Feb 28 Python
Django+python服务器部署与环境部署教程详解
Mar 30 Python
Pandas实现一列数据分隔为两列
May 18 Python
pandas.DataFrame.drop_duplicates 用法介绍
Jul 06 Python
聊聊Python中关于a=[[]]*3的反思
Jun 02 Python
Django中celery的使用项目实例
Python可视化神器pyecharts绘制地理图表
Python软件包安装的三种常见方法
Python+SeaTable实现计算两个日期间的工作日天数
Jul 07 #Python
Python实现数据的序列化操作详解
Jul 07 #Python
Python如何利用pandas读取csv数据并绘图
Python可视化神器pyecharts绘制水球图
Jul 07 #Python
You might like
PHP strtotime函数用法、实现原理和源码分析
2015/02/04 PHP
Javascript 日期处理之时区问题
2009/10/08 Javascript
基于jQuery的history历史记录插件
2010/12/11 Javascript
使用javascript获取flash加载的百分比的实现代码
2011/05/25 Javascript
javascript通过获取html标签属性class实现多选项卡的方法
2015/07/27 Javascript
JS实现可点击展开与关闭的左侧广告代码
2015/09/02 Javascript
AngularJS Module方法详解
2015/12/08 Javascript
jQuery实现手势解锁密码特效
2017/08/14 jQuery
Angularjs中date过滤器失效的问题及解决方法
2018/07/06 Javascript
Vue安装浏览器开发工具的步骤详解
2019/05/12 Javascript
解决layer 动态加载select 失效的问题
2019/09/18 Javascript
Vue实现兄弟组件间的联动效果
2020/01/21 Javascript
Vue使用vue-draggable 插件在不同列表之间拖拽功能
2020/03/12 Javascript
Python实现将xml导入至excel
2015/11/20 Python
一些常用的Python爬虫技巧汇总
2016/09/28 Python
Python实现爬虫设置代理IP和伪装成浏览器的方法分享
2018/05/07 Python
Python切片索引用法示例
2018/05/15 Python
Python字典对象实现原理详解
2019/07/01 Python
如何使用Flask-Migrate拓展数据库表结构
2019/07/24 Python
使用Python和百度语音识别生成视频字幕的实现
2020/04/09 Python
加拿大领先的优质厨具产品在线购物网站:Golda’s Kitchen
2017/11/17 全球购物
美国著名的女性内衣零售商:Frederick’s of Hollywood
2018/02/24 全球购物
运动鞋、足球鞋和慕尼黑球衣:Sport Münzinger
2019/08/26 全球购物
日本整理专家Marie Kondo的官方在线商店:KonMari
2020/06/29 全球购物
建筑设计所实习生自我鉴定
2013/09/25 职场文书
高级方案规划工程师岗位职责
2013/11/29 职场文书
客服专员岗位职责范本
2013/11/29 职场文书
党员教师个人对照检查材料范文
2014/09/25 职场文书
医院领导班子四风对照检查材料
2014/09/27 职场文书
乡镇三严三实学习心得体会
2014/10/13 职场文书
个性发展自我评价2015
2015/03/09 职场文书
签约仪式致辞
2015/07/30 职场文书
教你用Python matplotlib库制作简单的动画
2021/06/11 Python
springboot @ConfigurationProperties和@PropertySource的区别
2021/06/11 Java/Android
Golang 语言控制并发 Goroutine的方法
2021/06/30 Golang
Java 数据结构七大排序使用分析
2022/04/02 Java/Android