Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Exploding Donut

Hi I was wondering if it was possible to create an exploding donut in plotly?

I’ve managed to create it in matplotlib as seen below
finally%20side%20by%20side

currently with plotly I’ve managed to create this


Thanks!!

Hey,

I think this is not available for the moment. But just a rough idea coming to my mind, with the properties line and width :

trace = go.Pie(
    labels=labels,
    hole = 0.4, #Random Value
    values=values, 
    marker=dict(
        colors=colors,
        line=dict(color='#ffffff', width=8)
        )
     )

Just proposing, I did not try it on my side. I think this is the closest you can have, but not sure you will have exactly the result you want.

Quentin

Hi @skyartemis,

Here’s a full example based on @qdumont’s suggestion

import plotly.graph_objs as go
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()

labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
values = [4500,2500,1053,500]

pie = go.Pie(labels=labels, values=values)

pie.marker.line.width = 10
pie.marker.line.color = 'white'

pie.hole = 0.5

pie.textposition = 'outside'
pie.textinfo = 'label'
pie.showlegend = False

fig = go.Figure(data=[pie])
iplot(fig)

-Jon

2 Likes