So I have played around a bit and can create the following manually. I will look at doing it programmatically later.
I marked up the flow you posed so you can see where each relates
And here is the Sankey. Please note 8 and 9 have been reversed.
Here is the code I used to do it manually
label = ['Google Search', 'YouTube', 'AdMob', 'Google Play', 'Google Cloud',
'Other', 'Ad Revenue', 'Revenue', 'Gross Profit', 'Cost of Revenues',
'Operating Profit', 'Operating Expenses', 'TAC', 'Others', 'Net Profit',
'Tax', 'Other', 'R&D', 'S&M', 'G&A'
]
# Node Colors
color_for_nodes =['blue', 'blue', 'blue', 'gold', 'gold', 'gold', 'blue','blue','green', 'maroon',
'green', 'maroon', 'maroon','maroon', 'green', 'maroon','maroon', 'maroon', 'maroon',
'maroon', 'maroon']
color_for_links =['skyblue', 'skyblue', 'skyblue', 'yellow', 'yellow', 'yellow', 'skyblue', 'lightgreen',
'indianred', 'lightgreen', 'indianred', 'indianred', 'indianred', 'lightgreen',
'indianred', 'indianred', 'indianred', 'indianred', 'indianred']
# Data 4
source4 = [0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11]
target4 = [6, 6, 6, 7, 7, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
value4 = [39.5, 7.1, 7.9, 6.9, 6.9, 0.88, 54.5, 37.9, 31.2, 17.1, 20.8, 11.8,
19.3, 13.9, 2.3, 0.9, 10.3, 6.9, 3.6 ]
link4 = dict(source=source4, target=target4, value=value4, color=color_link)
node4 = dict(label = label, pad=35, thickness=20)
data4 = go.Sankey(link=link4, node=node)
fig1 = go.Figure(data4)
fig1.update_layout(
hovermode='x',
title='Stitching it all together',
font=dict(size=10, color='white'),
paper_bgcolor='#51504f'
)
fig1.update_traces(node_color = color_for_nodes,
link_color = color_for_links)
fig1.show()
Quite a bit of styling etc to be done but the basics are down