你好,我有我的数据字典如下
pDict = {'"Streptococcous targeted"': 678000 , '"s.coccous file read"': 6780 , '"Mycobacterium Collection being analysed"': 80 , '"Mycobacterium Collection being analysed"': 8560 , '"S. viridans encountered "':450 , '"S. thermophilus Analysis intiated"':300 }
labels = sorted(pDict.keys())
sizes = pDict.values()
k = len(pDict.keys())
# Build Pie chart
list = plt.cm.gist_rainbow(np.linspace(0, 1, k))
ax1 = fig.add_subplot(1,1,1,axisbg = 'grey')
ax1.pie(sizes, labels = labels, colors = list,
autopct='%1.1f%%', startangle=90)
我想将小于10%的dic值与其他值合并,并使用pyplot在饼图中绘制它们如何将小于10%的值组合到其他值
输出饼图应包含以下结果:
^{pr2}$谢谢
您只需先过滤pDict,如下所示:
其他一切都一样。在
也许有一种方法可以一步到位,但这是可行的。在
相关问题 更多 >
编程相关推荐