How do I use matplotlib autopct?

后端 未结 7 1651
野的像风
野的像风 2020-12-12 11:59

I\'d like to create a matplotlib pie chart which has the value of each wedge written on top of the wedge.

The documentation suggests I should use autopct

相关标签:
7条回答
  • 2020-12-12 12:29
    val=int(pct*total/100.0)
    

    should be

    val=int((pct*total/100.0)+0.5)
    

    to prevent rounding errors.

    0 讨论(0)
提交回复
热议问题