✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Text position inside for label and outside for value Pie Chart

Hey Guys,

Is there anyway to get a Pie Chart to have text on the slices and also on the outside? I was reading the documentation for textposition ( enumerated or array of enumerateds : “inside” | “outside” | “auto” | “none” )

but was not sure how to implement that if possible.

Essentially I would like to plot the label inside and the percent outside

textinfo=‘label+percent’,textposition = ‘inside for labe, outside for percent’


I have the same proplem, did you found the answer?

Unfortunately not my friend, if you happen to find a solution please let me know!

I compromised and changed the presentation of the data as it was too cluttered if the value was not able to be presented outside.

Hi @tehnexus and @Luidgi,

I don’t think it’s possible to place the label inside the wedge and the percent outside, at least not on a single pie trace.

But, here’s a work around that might work for you. If you create a figure with two identical Pie traces they will exactly overlap each other. So if you display the percentage on the outside of the first trace (the one behind) and the label on the inside of the second trace (the one in front) you’ll get the appearance that I think you want.

For example:

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

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

common_props = dict(labels=labels,

trace1 = go.Pie(

trace2 = go.Pie(

iplot([trace1, trace2], filename='basic_pie_chart')

Hope that helps!


Wow, cool lifehack!

Thanks a lot :grin:

Hi, I’m having the same problem.
Is there any way to achieve it with R?