图例默认的fontsize
太小。我用的是Seaborn,我不能在不影响linestyle
的情况下增加传说的fontsize
。有没有一种方法可以改变字体而不影响linestyle
?
ax = sns.lineplot(data=drinkability_df, x='threshold', y='undrinkable', hue='models_undrinkable', linewidth=2)
ax = sns.lineplot(data=drinkability_df, x='threshold', y='drinkable', hue='models_drinkable', linestyle='--', linewidth=2)
plt.title('Identifying Water Types By Thresholds', fontsize= 18)
plt.xlabel('Thresholds', fontsize= 16)
plt.ylabel('Drinkable Or Undrinkable', fontsize= 16)
style = ax.legend()
style_lines = style.get_lines()
for i in range(3,6):
style_lines[i].set_linestyle("--")
plt.setp(ax.legend().get_texts(), fontsize=15);
seaborn lineplot
csv这里
ax.legend()
生成新的图例;ax.get_legend()
返回当前值(如果存在)。