RE: Witness of the people, by the people, for the people
Hi @crokkon, thanks a lot for your comment. Actually that subpie was one of my favorite parts :)
I guess you're asking how to draw it? (since calculating the data is obvious.)
Here is the basic: https://matplotlib.org/gallery/pie_and_polar_charts/nested_pie.html
and seems there is no good library that does do the dirty work (color and subgroup job) intuitively.
But I have many categories, so I didn't want to set the colors manually, so I made a function to lighten the color automatically. (repeat the basic colors twice and then adjust them). Although I found some code on the web that does color adjustment, but it didn't work well, so I used https://pypi.org/project/webcolors/ for basic color function and changed the color by multiplication.
It actually took me some time since I haven't played with neither of nested pie nor the color before. Maybe there is some library to do this more easily but I wasn't able to find it unfortunately :( Hope this helps. Thanks again!