Python绘制桑基图之可视化神器pyecharts

您所在的位置:网站首页 荷花烟一般多少钱一条啊 Python绘制桑基图之可视化神器pyecharts

Python绘制桑基图之可视化神器pyecharts

2023-04-10 02:20| 来源: 网络整理| 查看: 265

from pyecharts import options as optsfrom pyecharts.charts import Sankey

colors = [ "#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061",]nodes = [ {"name": "a"}, {"name": "b"}, {"name": "a1"}, {"name": "b1"}, {"name": "c"}, {"name": "e"},]links = [ {"source": "a", "target": "a1", "value": 5}, {"source": "e", "target": "b", "value": 3}, {"source": "a", "target": "b1", "value": 3}, {"source": "b1", "target": "a1", "value": 1}, {"source": "b1", "target": "c", "value": 2}, {"source": "b", "target": "c", "value": 1},]c = ( Sankey() .set_colors(colors) .add( "sankey", nodes=nodes, links=links, pos_bottom="10%", focus_node_adjacency="allEdges", orient="vertical", linestyle_opt=opts.LineStyleOpts(opacity=0.2, curve=0.5, color="source"), label_opts=opts.LabelOpts(position="top"), ) .set_global_opts( title_opts=opts.TitleOpts(title="标题"), tooltip_opts=opts.TooltipOpts(trigger="item", trigger_on="mousemove"), ) .render("复杂桑基图.html"))



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3