If autopct is not None, return the tuple (patches, texts, autotexts),
where patches and texts are as above, and autotexts is a list of
Text instances for the numeric labels.
您需要更改autotexts的颜色;这只需通过set_color()完成:
_, _, autotexts = pie(fbfrac,labels = fblabel,autopct='%1.1f%%',pctdistance=0.8,startangle=90,colors=fbcolor)
for autotext in autotexts:
autotext.set_color('white')
您可以使用
pyplot.pie
的textprops
参数在一行中完成此操作。很简单:就你而言:
一个启发性的例子可以找到here。
来自^{} documentation :
您需要更改
autotexts
的颜色;这只需通过set_color()
完成:这将产生(使用Hogs and Dogs example):
相关问题 更多 >
编程相关推荐