1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| import plotly.graph_objects as go from plotly.subplots import make_subplots
asset_labels = ["資産", "債権", "A社", "B社", "株式", "C社", "D社", "預金","Z社"] asset_parents = ["", "資産", "債権", "債権", "資産", "株式", "株式", "資産","B社"] asset_values = [1000, 400, 300, 100, 200, 160, 40, 400, 50]
sunburst_fig = make_subplots( 1, 2, specs=[[{"type": "domain"}, {"type": "domain"}]] )
sunburst_fig.add_trace( go.Sunburst( labels=asset_labels, parents=asset_parents, values=asset_values, branchvalues="total", ), row=1, col=1, )
sunburst_fig.add_trace( go.Sunburst( labels=asset_labels, parents=asset_parents, values=asset_values, branchvalues="remainder", ), row=1, col=2, )
sunburst_fig.show()
|