欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

matplotlib---在figure中为多副子图添加一个legend(图例)

程序员文章站 2022-03-01 22:18:09
...

参考:https://*.com/questions/9834452/how-do-i-make-a-single-legend-for-many-subplots-with-matplotlib

https://zhuanlan.zhihu.com/p/35983270

https://zhuanlan.zhihu.com/p/36004578

https://www.zhihu.com/people/yang-fan-27-12/posts?page=3

from matplotlib import rcParams
params={'font.family':'serif',
        'font.serif':'Times New Roman',
        'font.style':'normal',
        'font.weight':'normal', #or 'blod'
        'font.size':'9',#or large,small,9==小五
        }
rcParams.update(params)

import matplotlib.lines as mlines
blue_line = mlines.Line2D([], [], color=Color[0], marker='.',
                          markersize=10, label='Blue stars')
fig.legend(handles=[blue_line]).get_frame().set_linewidth(0)

 

相关标签: pytorch学习