The autopct argument of pie may be callable, which will receive the current percentage. Thus, you will need to provide a function that returns an empty string for the values you want to omit the percentage.
def my_autopct(pct): return ('%.2f' % pct) if pct > 20 else '' ax.pie(df[col], labels=df.index, autopct=my_autopct, colors=colors)
If you need to parameterize the value in the autopct argument, you will need a function that returns a function, for example:
def autopct_generator(limit): def inner_autopct(pct): return ('%.2f' % pct) if pct > limit else '' return inner_autopct ax.pie(df[col], labels=df.index, autopct=autopct_generator(20), colors=colors)
For shortcuts, the best I can come up with is using a list:
for ax, col in zip(axes.flat, df.columns): data = df[col] labels = [n if v > data.sum() * 0.2 else '' for n, v in zip(df.index, data)] ax.pie(data, autopct=my_autopct, colors=colors, labels=labels)
Note, however, that the default legend is generated from the first labels passed, so you will need to pass all the values explicitly in order to keep it intact.
axes[0, 0].legend(df.index, bbox_to_anchor=(0, 0.5))