How to agregate the branches of a sunburst as average of the leafs?

I am working on a visualization of the availability of products for each car model in the world and I would like to use the sunburst chart to navigate through that heterarchical data.

The columns of my data frame are the following: [‘Region’, ‘Country’, ‘Brand’, ‘Model’, ‘Type’, ‘Seats’, ‘Doors’, ‘Transmission’, ‘Fuel Type’, ‘Volume’, ‘Coverage’, ‘color’]

The important column is the “coverage” column in %, which means basically how many products are available for that particular model in %. 100% means all products for that car are available.

What I would like to do is one of two things:

1: Using the path below, but having the root and branches to show the average of the leafs. p.e. Audi would show the average of the coverage of all its models, and the country Spain would show the average of the % of all the brands in that country, and so on. I would assume that in this case the size of each slice is proportional to that calculated average %

2: The second option would be to multiply the volume (amount of vehicles) times the % of coverage to get the size of the slices. BUT the labels of each slice should still be the aggregated average of coverage in %.

How can I configure the sunburst chart to get those results?


hi @Tonytoral
Welcome to the community. Can you share sample data with us? Did you try build the sunburst with the data or not yet?


thanks for the answer, yes, I can share the data I am working with. The values are randomly generated, but the structure is correct.

My code is here:

and I’m saving the results as interactive html files here:

Thanks for your support

Hello @adamschroeder , thanks for your answer. I shared some of my code and my data. As you can see, each of my leafs is a percentage (of products available). Therefore I would like that each layer in the branch would also be a percentage. This way I can get info like: we have 80% of Audi covered, but only 20% of Volvo. And the same one level up in the tree, for example, we have 80% of Portugal covered, but only 20% of France.
Thanks in advance for your help

hi @Tonytoral
I wrote you a DM to better understand what you’re trying to do. When we solve your question, we’ll post it here.

hi @adamschroeder ,

my whole question refers to the first figure, which is a sunburst chart. Thanks for your support!