✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly Pie chart


How can I achieve this chart with plotly?

Hi @Sherlocked welcome to the forum! I don’t think this is possible with only one pie chart, but they are enough options in plotly pie charts (see Pie Charts | Python | Plotly and pie Traces | Python | Plotly) so that you can hack the figure with two pie charts and transparent colors. I got started with the code below, probably you can tune the code even more so that it looks like your screenshot.

import plotly.express as px
import plotly.graph_objects as go
percents = [35, 65]


fig = go.Figure()
fig.add_trace(go.Pie(values=percents, hole=.9, rotation=150, 
                     marker_colors=['#00000000', 'black'],
                     textfont_size=1))
fig.add_trace(go.Pie(values=percents, hole=.8, rotation=150, 
                     marker_colors=['blue', '#00000000'],
                     textfont_size=20))
fig.show()

image