graphicsData.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:tieba-zhuaqu 作者: ankanch 项目源码 文件源码
def pieGraphics(Labels,ValueList,graphicTitle='??'):
    colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral', "blue","green","cyan","magenta"]
    maxdata = max(ValueList)
    explode = []
    for v in ValueList:
        if v == maxdata:
            explode.append(0.1)
        else:
            explode.append(0)
    print(explode)
    patches,l_text,p_text = plt.pie(ValueList, labels=Labels, colors=colors,autopct='%1.1f%%',explode=explode ,shadow=True, startangle=90)
    for font in l_text:
        font.set_fontproperties(FontProperties(fname=PATH_SUFFIX+'SIMLI.TTF'))
    plt.title(graphicTitle,fontproperties=font_set,y=1.05)
    # Set aspect ratio to be equal so that pie is drawn as a circle.
    plt.axis('equal')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号