相关疑难解决方法(0)

手动添加图例项目Python matplotlib

我正在使用matlibplot,我想手动向图例中添加颜色和标签的项目.我将数据添加到图中以指定会导致大量重复.

我的想法是:

    ax2.legend(self.labels,colorList[:len(self.labels)])
    plt.legend()
Run Code Online (Sandbox Code Playgroud)

其中self.labels是我希望传奇标签的项目数量,它采用大颜色列表的子集.但是,当我运行它时,这没有任何结果.

我错过了什么吗?

谢谢

python matplotlib

38
推荐指数
4
解决办法
4万
查看次数

标签 统计

matplotlib ×1

python ×1