MicapsFile.py 文件源码

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

项目:MicapsDataDraw 作者: flashlxy 项目源码 文件源码
def DrawTitle(m, title, headtxt):
        if m is plt:
            if title.mtitleposition is None:
                for desc in title.descs:
                    fontfile = r"C:\WINDOWS\Fonts\{0}".format(desc.font['family'])
                    if not os.path.exists(fontfile):
                        font = FontProperties(size=desc.font['fontsize'], weight=desc.font['weight'])
                    else:
                        font = FontProperties(fname=fontfile, size=desc.font['fontsize'], weight=desc.font['weight'])
                    plt.text(desc.pos[0], desc.pos[1], desc.text,
                             # size=desc.font['fontsize'], weight=desc.font['weight'],
                             color=desc.font['color'],
                             fontdict=desc.font,
                             fontproperties=font,
                             rotation=0,
                             ha='left', va='top')
            else:
                if title.mtitleposition == [0, 0]:
                    plt.title(headtxt, fontdict={'fontsize': 14})
                else:
                    plt.text(title.mtitleposition[0], title.mtitleposition[1], headtxt,
                             size=14,
                             weight='bold',
                             # color='blue',
                             # fontdict=desc.font,
                             # fontproperties=font,
                             rotation=0,
                             ha='left', va='top')
        else:
            plt.title(headtxt)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号