如何最好地指定matplotlib图例的字体粗细?我可以使用:
matplotlib.rcParams.update({'legend.fontsize':12})
当我使用matplotlib.rcParams.update({'legend.fontweight':'bold'})
来设置字体大小时,它会报错"'legend.fontweight'不是有效的rc参数"。
如何最好地指定matplotlib图例的字体粗细?我可以使用:
matplotlib.rcParams.update({'legend.fontsize':12})
当我使用matplotlib.rcParams.update({'legend.fontweight':'bold'})
来设置字体大小时,它会报错"'legend.fontweight'不是有效的rc参数"。
plt.legend(prop=dict(weight='bold')
。 - DanHicksteinlegend.get_texts()
并为每个记录调用适当的set_weight()
。 - Maksym Ganenko