I took the following picture from this post. Linking traces in nested pie chart (for legend toggle functionality)
I have data that would recreate this nested pie chart however I cant seem to find the way to connect data from the outer donut with the inner donut so it will show the outer donut as part of the inner donut percentage.
Any help or guidance would be appreciated.
Here’s a simplified code that recreates the following nested pie chart (also taken from the post
)import plotly.graph_objs as go
data = [# Portfolio (inner donut)
go.Pie(values=[20,40],
labels=[‘Reds’,‘Blues’],
domain={‘x’:[0.2,0.8], ‘y’:[0.1,0.9]},
hole=0.5,
direction=‘clockwise’,
sort=False,
marker={‘colors’:[’#CB4335’,’#2E86C1’]}),
# Individual components (outer donut)
go.Pie(values=[5,15,30,10],
labels=[‘Medium Red’,‘Light Red’,‘Medium Blue’,‘Light Blue’],
domain={‘x’:[0.1,0.9], ‘y’:[0,1]},
hole=0.75,
direction=‘clockwise’,
sort=False,
marker={‘colors’:[’#EC7063’,’#F1948A’,’#5DADE2’,’#85C1E9’]},
showlegend=False)]
fig = go.Figure(data=data, layout={‘title’:‘Nested Pie Chart’})
plotly.offline.iplot(fig)