我正在使用一个外部模块,它会自动将图例添加到图中。 我想知道是否有关闭图例的方法,比如ax.set_legend(False)。matplotlib取消轴对象上的图例
我可以盗号模块修复它,但我宁愿不这么做。
例如:
f = plt.figure()
ax = f.add_subplot(111)
externalfunction(ax)
# in the function ax.legend() has been called
# would like to turn off the legend here
plt.show()
更新:
我提出这个 https://github.com/matplotlib/matplotlib/issues/2792
你能为此做一个github问题吗?它看起来像传奇艺术家是不可移动的,但它应该是。 – tacaswell
是必要的吗?我觉得xndrme的回答是我所需要的。 – Anake
@Anake tcaswell的建议是,以改善将来使用的框架,你可以用我的解决方案,但它不应该是这个样子;) –