How to set a plotly tree chart to calculate the sum instead of the average of the children values, with python?

The official description about this chart code says : " If a color argument is passed, the color of a node is computed as the average of the color values of its children, weighted by their values. " But i need the color to be the sum of the childrens, not the average. Is it possible ?

import as px
import numpy as np
df ="year == 2007")
fig = px.sunburst(df, path=['continent', 'country'], values='pop',
                  color='lifeExp', hover_data=['iso_alpha'],
                  color_continuous_midpoint=np.average(df['lifeExp'], weights=df['pop']))

Hi, @vic131!
Did you solve this question? I’d like to do the same thing, show the sum of children instead of the average.

Same problem here, couldn’t see an option to calculate sum up the tree hierarchy