pyecharts绘制3D地图

利用Pyecharts可以绘制各种三维地图,包括基本三维地图、三维柱状图、三维散点图等。

一、绘制三维地图

from pyecharts.charts import Map3D

from pyecharts import options as opts

c = (

Map3D()

.add_schema(

maptype=”浙江”,

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)”

),

),

)

.set_global_opts(

title_opts=opts.TitleOpts(title=”浙江行政区划地图”),

visualmap_opts=opts.VisualMapOpts(is_show=False),

tooltip_opts=opts.TooltipOpts(is_show=True),

)

.render(“e:/python/10-1.html”)

)

一、绘制三维柱状图

from pyecharts.charts import Map3D

from pyecharts import options as opts

gdpzj3D=[

(“杭州”,[120.2,30.3,18109]),

(“宁波”,[121.5,29.8,14594.9]),

(“温州”,[120.67,28.0,7585]),

(“绍兴”,[120.58,29.99,6795]),

(“嘉兴”,[120.75,30.76,6355.28]),

(“台州”,[121.42,28.66,5786.19]),

(“金华”,[119.65,29.09,5355.44]),

(“湖州”,[120.10,30.87,3644.9]),

(“衢州”,[118.87,28.94,1875.61]),

(“丽水”,[119.92,28.45,1710.03]),

(“舟山”,[122.10,30.02,1703.62])

]

c = (

Map3D()

.add_schema(

maptype=”浙江”,

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,

text_style=opts.TextStyleOpts(

color=”#fff”, font_size=16, background_color=”rgba(0,0,0,0)”

),

),

)

.add(

series_name=””,

data_pair=gdpzj3D,

type_=ChartType.BAR3D,

bar_size=1,

shading=”lambert”,

label_opts=opts.LabelOpts(

is_show=False,)

)

.set_global_opts(

title_opts=opts.TitleOpts(title=”浙江GDP-3DBar地图”),

visualmap_opts=opts.VisualMapOpts(is_show=False),

tooltip_opts=opts.TooltipOpts(is_show=True),

)

.render(“e:/python/10-2.html”)

)

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年10月3日
下一篇 2022年10月3日

相关推荐