小白学Python(16)——pyecharts 绘制地理图表 Geo

Geo-基本示例

复制代码
 1 from example.commons import Faker
 2 from pyecharts import options as opts
 3 from pyecharts.charts import Geo
 4 from pyecharts.globals import ChartType, SymbolType
 5 
 6 geo = (
 7         Geo()
 8         .add_schema(maptype="china")
 9         .add("geo", [list(z) for z in zip(Faker.provinces, Faker.values())])
10         .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
11         .set_global_opts(
12             visualmap_opts=opts.VisualMapOpts(),
13             title_opts=opts.TitleOpts(title="Geo-基本示例"),
14         )
15     )
16 geo.render()
复制代码

Geo-Lines-background

 

复制代码
 1 from example.commons import Faker
 2 from pyecharts import options as opts
 3 from pyecharts.charts import Geo
 4 from pyecharts.globals import ChartType, SymbolType
 5 
 6 geo = (
 7        Geo()
 8         .add_schema(
 9             maptype="china",
10             itemstyle_opts=opts.ItemStyleOpts(color="#323c48", border_color="#111"),
11         )
12         .add(
13             "",
14             [("广州", 55), ("北京", 66), ("杭州", 77), ("重庆", 88)],
15             type_=ChartType.EFFECT_SCATTER,
16             color="white",
17         )
18         .add(
19             "geo",
20             [("广州", "上海"), ("广州", "北京"), ("广州", "杭州"), ("广州", "重庆")],
21             type_=ChartType.LINES,
22             effect_opts=opts.EffectOpts(
23                 symbol=SymbolType.ARROW, symbol_size=6, color="blue"
24             ),
25             linestyle_opts=opts.LineStyleOpts(curve=0.2),
26         )
27         .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
28         .set_global_opts(title_opts=opts.TitleOpts(title="Geo-Lines-background"))
29     )
30 
31 geo.render()
复制代码

Geo-EffectScatter

复制代码
 1 from example.commons import Faker
 2 from pyecharts import options as opts
 3 from pyecharts.charts import Geo
 4 from pyecharts.globals import ChartType, SymbolType
 5 
 6 geo = (
 7      Geo()
 8         .add_schema(maptype="china")
 9         .add(
10             "geo",
11             [list(z) for z in zip(Faker.provinces, Faker.values())],
12             type_=ChartType.EFFECT_SCATTER,
13         )
14         .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
15         .set_global_opts(title_opts=opts.TitleOpts(title="Geo-EffectScatter"))
16     )
17 
18 geo.render()
复制代码

 Map-基本示例

复制代码
 1 from example.commons import Faker
 2 from pyecharts import options as opts
 3 from pyecharts.charts import Map
 4 
 5 map=(
 6     Map()
 7         .add("商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china")
 8         .set_global_opts(title_opts=opts.TitleOpts(title="Map-基本示例"))
 9     )
10 
11 map.render()
复制代码

 Map-VisualMap(连续型)

复制代码
 1 from example.commons import Faker
 2 from pyecharts import options as opts
 3 from pyecharts.charts import Map
 4 
 5 map=(
 6      Map()
 7         .add("商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china")
 8         .set_global_opts(
 9             title_opts=opts.TitleOpts(title="Map-VisualMap(连续型)"),
10             visualmap_opts=opts.VisualMapOpts(max_=200),
11         )
12     )
13 map.render()
复制代码

 

 

posted @   徐海建  阅读(7071)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示