From 9f10be5b98a67ac3a7a83767e6329a8141d00404 Mon Sep 17 00:00:00 2001 From: beginner-fei <283807775@qq.com> Date: Thu, 7 May 2020 09:13:13 +0800 Subject: [PATCH] submit code --- chaoxi/Earth_view/guizhou_map_3d.html | 279 ++++++ chaoxi/Earth_view/guizhou_map_3d.py | 52 ++ chaoxi/Earth_view/map3d_china_base.html | 186 ++++ chaoxi/Earth_view/map3d_china_base.py | 41 + chaoxi/Earth_view/world_map.html | 162 ++++ chaoxi/Earth_view/world_map.py | 22 + chaoxi/Earth_view/world_map_3d.html | 1086 +++++++++++++++++++++++ chaoxi/Earth_view/world_map_3d.py | 30 + chaoxi/README.md | 10 +- 9 files changed, 1864 insertions(+), 4 deletions(-) create mode 100644 chaoxi/Earth_view/guizhou_map_3d.html create mode 100644 chaoxi/Earth_view/guizhou_map_3d.py create mode 100644 chaoxi/Earth_view/map3d_china_base.html create mode 100644 chaoxi/Earth_view/map3d_china_base.py create mode 100644 chaoxi/Earth_view/world_map.html create mode 100644 chaoxi/Earth_view/world_map.py create mode 100644 chaoxi/Earth_view/world_map_3d.html create mode 100644 chaoxi/Earth_view/world_map_3d.py diff --git a/chaoxi/Earth_view/guizhou_map_3d.html b/chaoxi/Earth_view/guizhou_map_3d.html new file mode 100644 index 0000000..032fb6c --- /dev/null +++ b/chaoxi/Earth_view/guizhou_map_3d.html @@ -0,0 +1,279 @@ + + + + + Awesome-pyecharts + + + + + + +
+ + + diff --git a/chaoxi/Earth_view/guizhou_map_3d.py b/chaoxi/Earth_view/guizhou_map_3d.py new file mode 100644 index 0000000..32b7b1f --- /dev/null +++ b/chaoxi/Earth_view/guizhou_map_3d.py @@ -0,0 +1,52 @@ +from pyecharts import options as opts +from pyecharts.charts import Map3D +from pyecharts.globals import ChartType + +# 写入省份内各地区经纬度 +example_data = [ + [[106.70722,26.59820, 1000],[106.63024, 26.64702, 1000]], + [[104.83023, 26.59336], [106.92723, 27.72545]], + [[105.30504, 27.29847], [107.52034, 26.29322]], + [[107.89868, 26.52881], [104.948571, 25.077502]], + [[105.9462, 26.25367], [109.18099, 27.69066]], +] +# 添加 3D 地图 +c = ( + Map3D(init_opts=opts.InitOpts(width='1200px', height='1200px')) + .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=True, + 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=True), + + ) + .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, + ), + label_opts=opts.LabelOpts(is_show=True), + ) + .set_global_opts(title_opts=opts.TitleOpts(title="Map3D-GuiZhou3D")) + .render("guizhou_map_3d.html") +) diff --git a/chaoxi/Earth_view/map3d_china_base.html b/chaoxi/Earth_view/map3d_china_base.html new file mode 100644 index 0000000..e899390 --- /dev/null +++ b/chaoxi/Earth_view/map3d_china_base.html @@ -0,0 +1,186 @@ + + + + + Awesome-pyecharts + + + + + + +
+ + + diff --git a/chaoxi/Earth_view/map3d_china_base.py b/chaoxi/Earth_view/map3d_china_base.py new file mode 100644 index 0000000..5ffde84 --- /dev/null +++ b/chaoxi/Earth_view/map3d_china_base.py @@ -0,0 +1,41 @@ +from pyecharts import options as opts +from pyecharts.charts import Map3D +from pyecharts.globals import ChartType + +c = ( + Map3D(init_opts=opts.InitOpts(width='1300px', height='1300px',bg_color='#EBEBEB')) + + .add_schema( + itemstyle_opts=opts.ItemStyleOpts( + color="#CDBA96", + opacity=1, + border_width=0.8, + border_color="rgb(62,215,213)", + ), + map3d_label=opts.Map3DLabelOpts( + is_show=True, + text_style=opts.TextStyleOpts( + color="#104E8B", font_size=16, background_color="rgba(0,0,0,0)" + ), + ), + emphasis_label_opts=opts.LabelOpts(is_show=True), + light_opts=opts.Map3DLightOpts( + main_color="#FFEBCD", + 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="全国行政区划地图"), + visualmap_opts=opts.VisualMapOpts(is_show=False), + tooltip_opts=opts.TooltipOpts(is_show=True), + ) + .render("map3d_china_base.html") +) + + diff --git a/chaoxi/Earth_view/world_map.html b/chaoxi/Earth_view/world_map.html new file mode 100644 index 0000000..833ccdd --- /dev/null +++ b/chaoxi/Earth_view/world_map.html @@ -0,0 +1,162 @@ + + + + + Awesome-pyecharts + + + + + +
+ + + diff --git a/chaoxi/Earth_view/world_map.py b/chaoxi/Earth_view/world_map.py new file mode 100644 index 0000000..11a8cf4 --- /dev/null +++ b/chaoxi/Earth_view/world_map.py @@ -0,0 +1,22 @@ +from pyecharts import options as opts +from pyecharts.charts import Map +from pyecharts.faker import Faker + +c = ( + Map(init_opts=opts.InitOpts(width='1500px', height='1200px',bg_color='#E0EEEE')) + # 加载世界地图实例 + .add("世界地图", [list(z) for z in zip(Faker.country, Faker.values())], "world") + # 不显示地图标志 + .set_series_opts(label_opts=opts.LabelOpts(is_show=False)) + .set_global_opts( + # 配置项标题设置 + title_opts=opts.TitleOpts(title="世界地图示例"), + visualmap_opts=opts.VisualMapOpts(max_=200) + ) + # 生成超文本文件 + .render("world_map.html") +) + + + + diff --git a/chaoxi/Earth_view/world_map_3d.html b/chaoxi/Earth_view/world_map_3d.html new file mode 100644 index 0000000..4b5c60e --- /dev/null +++ b/chaoxi/Earth_view/world_map_3d.html @@ -0,0 +1,1086 @@ + + + + + Awesome-pyecharts + + + + + + + +
+ + + diff --git a/chaoxi/Earth_view/world_map_3d.py b/chaoxi/Earth_view/world_map_3d.py new file mode 100644 index 0000000..329e0ca --- /dev/null +++ b/chaoxi/Earth_view/world_map_3d.py @@ -0,0 +1,30 @@ +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='1000px', height='1000px',bg_color='#00BBFF'))# + .add_schema() + .add( + maptype="world", + series_name="World Population", + data_pair=POPULATION[1:], + is_map_symbol_show=True, + label_opts=opts.LabelOpts(is_show=True), + ) + .set_global_opts( + title_opts=opts.TitleOpts(title="3D 地球示例"), + # 设置地球属性 + visualmap_opts=opts.VisualMapOpts( + min_=low, + max_=high, + range_text=["max", "min"], + is_calculable=True, + range_color=["lightskyblue", "yellow", "orangered"], + ) + ) + .render("world_map_3d.html") +) \ No newline at end of file diff --git a/chaoxi/README.md b/chaoxi/README.md index 7e4cfd4..453cd3c 100644 --- a/chaoxi/README.md +++ b/chaoxi/README.md @@ -1,9 +1,11 @@ # Python 代码实例 -+ [feiyan_data](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/2020-02-24-feiyan_data) :肺炎数据抓取并展示 -+ [cherry_tree](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/2020-03-24-cherry_tree) :Python 樱花小技 -+ [jupyter_notebook](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/2020-03-30-jupyter_notebook) :Python Jupyter notebook 操作 -+ [send_email](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/2020-04-07-send_email) :今天,我用 Python 给武汉人民发一封邮件 ++ [feiyan_data](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/feiyan_data) :肺炎数据抓取并展示 ++ [cherry_tree](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/cherry_tree) :Python 樱花小技 ++ [jupyter_notebook](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/jupyter_notebook) :Python Jupyter notebook 操作 ++ [send_email](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/send_email) :今天,我用 Python 给武汉人民发一封邮件 ++ [Earth_view](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/Earth_view) :如何用 Python 制作地球仪? + ---