這是一個很快的事情,這讓我非常煩惱。我遵循strange matplotlib zorder behavior with legend and errorbar中的指示,但它不起作用。這裏是一個非常簡單的工作示例matplotlib.legend.set_zorder()在ipython筆記本中不起作用
x = np.linspace(0,10)
y = (x-5)**2
plt.plot(x,y,label='test curve',zorder=100)
plt.legend(loc='center right').set_zorder(102)
如果你試試這個,你會看到那個傳說依然是曲線的下方,儘管zorder
ING。有誰知道爲什麼?
我使用matplotlib 1.3.1 IPython中3.1.0
對我來說,傳說和曲線似乎是正確的順序,但圖例矩形沒有不透明的背景。我用'matplotlib 1.4.3'試過這個圖例,圖例是不透明的。 – cel
也嘗試過'matplotlib 1.3.1',這對我也很有效。也許後端問題? – cel