# Node and link sizes not matching in a Plotly Sankey Diagram

Hi all!

I am learning Python plotting with Plotly Sankey Diagram and I am trying to plot income statements of stocks.

I am unable to figure out why the node and link sizes have a discrepancy at some of the nodes. For example, Income before tax (value=2B) going into Income Tax (value=417M) and Net Income - Cont. Ops (value=1.58B)

Here is the code:

fig = go.Figure(data=[go.Sankey(
node = dict(
thickness = 20,
line = dict(color = âwhiteâ, width =0),
label = [f"Total Revenue {fmt_df.at[0,'totalRevenue']}", #0 f"Gross Profit {fmt_df.at[0,âgrossProfitâ]}â, #1
f"Cost of Revenue -{fmt_df.at[0,'costOfRevenue']}", #2 f"SG&A -{fmt_df.at[0,âsellingGeneralAdministrativeâ]}â, #3
f"R&D -{fmt_df.at[0,'researchDevelopment']}", #4 f"Other -{fmt_df.at[0,âotherOperatingExpensesâ]}â, #5
f"Operating Income {fmt_df.at[0,'operatingIncome']}", #6 f"Income Before Tax {fmt_df.at[0,âincomeBeforeTaxâ]}â, #7
f"Other Income Expenses {fmt_df.at[0,'totalOtherIncomeExpenseNet']}", #8 f"Income Tax {fmt_df.at[0,âincomeTaxExpenseâ]}â, #9
f"Net Income - Cont Ops {fmt_df.at[0,'netIncomeFromContinuingOps']}", #10 f"Discontinued Operations {fmt_df.at[0,âdiscontinuedOperationsâ]}â, #11
f"Net Income \${fmt_df.at[0,ânetIncomeâ]}" #12
],
color = [â#519E3Fâ,â#519E3Fâ,â#BC271Bâ,â#BC271Bâ,â#BC271Bâ,â#BC271Bâ,â#519E3Fâ,â#519E3Fâ,â#BC271Bâ,â#BC271Bâ,â#519E3Fâ,â#519E3Fâ,â#519E3Fâ]
),
textfont=dict(family=âsans serifâ,size=20,
color=ârgba(0,0,0,1)â),
source = sources,
target = targets,
value = values,
))])
fig.show()

sources = [0,0,1,1,1,6,6,7,7,10,11]
targets = [1,2,6,3,4,7,8,10,9,12,12]