You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zorder is not respected by all parts of errorbar #1622
@tacaswell Commit 6dd3204 looks fine to me. It doesn't look like it's currently a pull request. Would you be able to create one against v1.2.x? Then Travis can do its magic.
I was not sure the best place to make this fix. I looked at pushing support for zorder all the way down to Collection but went with what I thought was the minimal change instead.
@agbuckley This isn't a bug that we can easily fix. If you give a z-order to the errorbar (which is greater than 2) it will now behave correctly.
The underlying issue here is that the errorbar is rendered as three artists, and the lines are rendered as 522 artists. The vertical lines are drawn as a collection, everything else is a line. The collection and lines are stored in different internal lists which are then concatenated and sorted (in a stable manner) by zorder which determines the draw order. The stable part is important because as the lists are appended too in the order they are added to the axes. Hence, in this case the vertical lines (which are a collection) are drawn first, then the gray lines, then blue line and the caps.
I have thoughts on how to fix this, but they involve a rather major refactoring of the internals and are at least a year out.
Ah, I see: the bug that was fixed was non-passing of the z-order to rendering of errorbar verticals, but the counterintuitive implicit ordering (with no zorder argument) is still just part of how mpl is, for now? Good to know... and best of luck for finding time & enthusiasm for that internal refactoring! Thanks.
The minimal example at the top of this bug still doesn't work, so I'll reopen to reflect that. In the meantime, passing zorder=3 to plt.errorbar seems to do the trick.
Reacted by Frank Breitling, Leindert A. Boogaard, Zhaozhou Li, Alex Lamson and Cesar
Activity
dmcdougall commentedon Dec 30, 2012
@tacaswell Commit 6dd3204 looks fine to me. It doesn't look like it's currently a pull request. Would you be able to create one against v1.2.x? Then Travis can do its magic.
first pass at getting fixing Issue matplotlib#1622
tacaswell commentedon Dec 30, 2012
Done.
I was not sure the best place to make this fix. I looked at pushing support for zorder all the way down to
Collectionbut went with what I thought was the minimal change instead.dmcdougall commentedon Dec 31, 2012
This is the 'correct' solution, in my opinion.
This is the solution most appropriate for the maintenance branch, in my opinion.
dmcdougall commentedon Jan 2, 2013
Fixed in #1628.
agbuckley commentedon Sep 22, 2015
I just encountered the same problem with mpl 1.4.2:
Has this problem resurfaced? I haven't seen any mention of it in the changelog up to 1.4.3.
tacaswell commentedon Sep 23, 2015
@agbuckley This isn't a bug that we can easily fix. If you give a z-order to the errorbar (which is greater than 2) it will now behave correctly.
The underlying issue here is that the errorbar is rendered as three artists, and the lines are rendered as 522 artists. The vertical lines are drawn as a collection, everything else is a line. The collection and lines are stored in different internal lists which are then concatenated and sorted (in a stable manner) by zorder which determines the draw order. The stable part is important because as the lists are appended too in the order they are added to the axes. Hence, in this case the vertical lines (which are a collection) are drawn first, then the gray lines, then blue line and the caps.
I have thoughts on how to fix this, but they involve a rather major refactoring of the internals and are at least a year out.
agbuckley commentedon Sep 23, 2015
Ah, I see: the bug that was fixed was non-passing of the z-order to rendering of errorbar verticals, but the counterintuitive implicit ordering (with no zorder argument) is still just part of how mpl is, for now? Good to know... and best of luck for finding time & enthusiasm for that internal refactoring! Thanks.
fkbreitl commentedon Feb 16, 2017
This bug is back in matplotlib 2.0.0!
dstansby commentedon Feb 16, 2017
The minimal example at the top of this bug still doesn't work, so I'll reopen to reflect that. In the meantime, passing
zorder=3toplt.errorbarseems to do the trick.tacaswell commentedon Apr 3, 2021
fixed by #18216