# %% [markdown] # ### Sankey with open("data/energy.json") as j: data = json.load(j) sankey = Sankey() sankey.add("", nodes=data["nodes"], links=data["links"]) sankey.render_notebook() # %% [markdown] # ### Sunburst with open("data/drink_flavors.json") as f: data = json.load(f) sunburst = Sunburst() sunburst.add("", data) sunburst.render_notebook() # sunburst.render("output/sunburst.html") # %% [markdown] # ### Graph -- 关系图 import itertools as itl nodes = [{ "name": "N1", "symbolSize": 1 }, { "name": "N2", "symbolSize": 2 }, { "name": "N3",
myitemlist.append(sunburstitem) mysunburst.add("", myitemlist, radius=[0, "95%"], highlight_policy="ancestor", sort_="null", levels=[ {}, { "r0": "15%", "r": "76%", "itemStyle": { "borderWidth": 2 }, "label": { "rotate": "radial" }, }, { "r0": "76%", "r": "80%", "label": { "align": "right", "position": "outside", "silent": False }, "itemStyle": { "borderWidth": 3 }, }, ]) mysunburst.set_global_opts(