Mix of pie and sunburst charts

Hey everyone,

I came across this beautiful visual on reddit and would like to know if it is possible to replicate it in Dash ?

source: https://www.reddit.com/r/dataisbeautiful/comments/m8oj1e/world_vaccinations_as_of_march_19_2021_oc/

The basis is a pie chart, and the pie slices areas are filled. Then, it could be cool to further detail it by countries per continent, like a sunchart.

As a starting point, showing the percentages as hover values or even in the pie shouldnt be too difficult, but am unsure on how to have the slice areas filled as such. Didnt find anything similar anywhere

Thank you for any ideas!

Ended up choosing a Sunburst as it looks the most similar to the reddit post. However, I have no idea on how to fill partially the areas of the pie sectors. Find below some working sample code. It uses international covid-19 data.

import dash
import numpy as np
import pandas as pd
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px

app = dash.Dash(__name__)  
server = app.server
# importing & cleaning
df = pd.read_csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv",low_memory=False)
df = df.fillna(0);df = df.replace(np.nan,0)
df["date"] = pd.to_datetime(df["date"], format ="%Y-%m-%d")
df = df[df["date"]=="2021-03-15"].sort_values(by="population", ascending=False)
take_out = ['World','Africa','North America', 'South America', 'Europe', 'European Union', "International", 'Asia', "Macao", 'Oceania']
df =df[~df['location'].isin(take_out)]

# sunburst
fig = px.sunburst(df, path=['continent', 'location'], values='population')
app.layout = html.Div(dcc.Graph(id="graph_sunburst", figure=fig))

if __name__ == "__main__":


To replicate the original plot, we need: the vaccination rates per country/continent and the area of the sectors of the pie. To get the first, simply divide people_vaccined by population. For the second, $$\pi r^2 \frac{\alpha}{360}$$ where alpha is continent angle in the pie.
Then, to get the area corresponding to that percentage per country, as shown in the reddit post above, multiply one by the other.

The problem is how do we implement the partial coloring of the circle sector ? (and after that for the countries, which are not sectors).

I’d appreciate some help for the implementation. I have looked into the documentation of both px.sunburst and go.sunburst but i am unsure where to look; the color arguments don’t mention partial coloring.
Thank you very much! :slight_smile: