有人可以向我解释这段代码吗?我知道
characters
列表是所有名称,但是 parent
列表如何转换为图表上的位置? value
是做什么的?海图怎么知道以挪士是赛斯的儿子?
import plotly.express as px
data = dict(
character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
value=[10, 14, 12, 10, 2, 6, 6, 4, 4])
fig = px.sunburst(
data,
names='character',
parents='parent',
values='value',
)
fig.show()