如果我按照myfigure=Figure((5.0, 4.0), dpi=100)
在matplotlib中初始化我的数字,为什么我不能使用figlegend(handles,labels,'upper center')
?为什么我通常不能使用与myfigure = plt.figure()
一起使用的函数? (如果我导入了from matplotlib import pyplot as plt
)
如果我能怎么做呢?
此致
答案 0 :(得分:1)
figlegend pyplot函数是一个非常简单的图形方法包装器。 figlegend的代码:
def figlegend(handles, labels, loc, **kwargs):
...
l = gcf().legend(handles, labels, loc, **kwargs)
draw_if_interactive()
return l
正如您所看到的,您真正需要做的就是在图形上使用图例方法来获得相同的结果。
HTH