我想让我的图例尺寸在Pyplot中更大。我用这个答案来做。这是我的代码。
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
plt.rcParams['figure.figsize'] = [15, 7]
lst = [1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,4,5,6]
plt.plot(lst)
plt.legend(fontsize="x-large") # Here I make it bigger but doesn't work
plt.legend(["This is my legend"])
plt.ylabel('some numbers')
plt.show()
我得到这个错误,我不知道是什么错了。我不明白什么是"艺术家"。意味着这里。
没有找到有标签的艺术家放在图例中。注意,当没有参数调用legend()时,标签以下划线开头的艺术家将被忽略。
艺术家"是来自matplotlib的术语:
https://matplotlib.org/stable/tutorials/intermediate/artists.html
这个错误信息可能意味着图例中没有可以更改字体大小的项目。
可以将fontsize
参数传递给创建图例的相同的plt.legend
调用,或者在创建图例后调用plt.legend(fontsize=...)
。