Skip to content

ENH: errorbar color cycle clean up #5593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 30, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MNT: use zorder for barsabove
  • Loading branch information
tacaswell committed May 13, 2016
commit d6881f08939727d7002cf618b7286f599a42801c
23 changes: 9 additions & 14 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2793,6 +2793,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
.. plot:: mpl_examples/statistics/errorbar_demo.py

"""
kwargs.setdefault('zorder', 2)

if errorevery < 1:
raise ValueError(
Expand Down Expand Up @@ -2850,17 +2851,13 @@ def errorbar(self, x, y, yerr=None, xerr=None,

l0 = None

# Instead of using zorder, the line plot is being added
# either here, or after all the errorbar plot elements.
if barsabove and plot_line:
# in python3.5+ this can be simplified
eb_style = dict(base_style)
eb_style.update(**kwargs)
l0 = mlines.Line2D(x, y, **eb_style)
self.add_line(l0)
# make the style dict for the 'normal' plot line
plot_line_style = dict(base_style)
plot_line_style.update(**kwargs)
if barsabove:
plot_line_style['zorder'] = kwargs['zorder'] - .1
else:
plot_line_style['zorder'] = kwargs['zorder'] + .1

# make the style dict for the line collections (the bars)
eb_lines_style = dict(base_style)
Expand Down Expand Up @@ -2903,6 +2900,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
eb_cap_style[key] = kwargs[key]
eb_cap_style['color'] = ecolor

if plot_line:
l0 = mlines.Line2D(x, y, **plot_line_style)
self.add_line(l0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick this variable name looks a bit to close to 10 I first read the line as self.add_line(10)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, will fix that.


barcols = []
caplines = []

Expand Down Expand Up @@ -3067,12 +3068,6 @@ def extract_err(err, data):
for l in caplines:
self.add_line(l)

if not barsabove and plot_line:
# in python3.5+ this can be simplified
eb_style = dict(base_style)
eb_style.update(**kwargs)
l0 = mlines.Line2D(x, y, **eb_style)
self.add_line(l0)

self.autoscale_view()
self._hold = holdstate
Expand Down