如何使用plt.semilogy()在同一把斧头上添加多个图例

时间:2019-07-14 22:34:03

标签: python matplotlib legend pca

我通过以下方式进行了一些PCA分析:https://jotterbach.github.io/2016/03/24/Principal_Component_Analysis/

但是当我创建PCA图时,图例有问题:

enter image description here

plt.semilogy(pca_1.explained_variance_ratio_, '--o')
plt.semilogy(pca_1.explained_variance_ratio_.cumsum(), '--o') 
version, slope is much smaller
plt.xlabel('Principle Component')
plt.ylabel('Explained Variance')
plt.legend('Explained Variance b')

图例名称仅用于实验,不知道为什么它只能显示第一个字母,有人可以帮助我吗?非常感谢。

0 个答案:

没有答案
相关问题