我有一个字符串列表:
How many glasses are on the tab ?
What does the sign say ?
Has the pizza been baked ?
Do you think the boy on the ground has broken legs ?
Is this man crying ?
How many pickles are on the plate ?
What is the shape of the plate?
…
如何在 Python 中将其转换为旭日图?
旭日图按前四个词显示问题的分布,弧长与包含该词的问题数量成正比,白色区域是贡献太小而无法显示的词。
( Image source -> 第 5 页,图 3)
问题How to make a sunburst plot in R or Python?不对输入格式做出任何假设,Python 答案假设输入具有非常不同的格式。
最佳答案
扩展 Jimmy Ata的 answer ,它指向 Python plotly 包:
您可以使用 https://plotly.com/python/sunburst-charts/ :
来自同一页面的示例:
# From https://plotly.com/python/sunburst-charts/
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()
关于python - 如何从 Python 中的字符串列表制作旭日图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54997495/