1 回答

TA贡献1810条经验 获得超5个赞
该版本在官方参考graph_objects
中可用。
import plotly.graph_objects as go
color_discrete_sequence = ['', '#FFAA00', '#2D5F91','#819FBD','#819FBD','#91D4D2', '#96BEE6', '#C0D8F0','#E8655F','#F1A39F','#48B7B4']
fig =go.Figure(go.Sunburst(
labels=\["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"\],
parents=\["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" \],
values=\[10, 14, 12, 10, 2, 6, 6, 4, 4\],
marker=dict(colors=color_discrete_sequence)
))
# Update layout for tight margin
# See https://plotly.com/python/creating-and-updating-figures/
fig.update_layout(margin = dict(t=0, l=0, r=0, b=0))
fig.show()
添加回答
举报