diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py
index 6e5b80397cde..19095e060d02 100644
--- a/lib/matplotlib/axes.py
+++ b/lib/matplotlib/axes.py
@@ -5441,7 +5441,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
lines_kw['lw']=kwargs['lw']
if 'transform' in kwargs:
lines_kw['transform'] = kwargs['transform']
-
+ if 'zorder' in kwargs:
+ lines_kw['zorder'] = kwargs['zorder']
+
# arrays fine here, they are booleans and hence not units
if not iterable(lolims):
lolims = np.asarray([lolims]*len(x), bool)
@@ -5489,6 +5491,9 @@ def xywhere(xs, ys, mask):
plot_kw['mew']=kwargs['mew']
if 'transform' in kwargs:
plot_kw['transform'] = kwargs['transform']
+ if 'zorder' in kwargs:
+ plot_kw['zorder'] = kwargs['zorder']
+
if xerr is not None:
if (iterable(xerr) and len(xerr)==2 and
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.pdf b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.pdf
new file mode 100644
index 000000000000..5279f02b1db6
Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.png b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.png
new file mode 100644
index 000000000000..61d1b902eda0
Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.svg b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.svg
new file mode 100644
index 000000000000..add9f4b310da
--- /dev/null
+++ b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_zorder.svg
@@ -0,0 +1,1061 @@
+
+
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.pdf b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.pdf
new file mode 100644
index 000000000000..2b02a6f915a5
Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.png b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.png
new file mode 100644
index 000000000000..7acd8e21b3ca
Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.svg b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.svg
new file mode 100644
index 000000000000..bddb8241c58b
--- /dev/null
+++ b/lib/matplotlib/tests/baseline_images/test_axes/vline_hline_zorder.svg
@@ -0,0 +1,1028 @@
+
+
+
+
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index 1283bc03794f..82aac0d87058 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -936,3 +936,33 @@ def test_transparent_markers():
if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
+
+
+@image_comparison(baseline_images=['vline_hline_zorder',
+ 'errorbar_zorder'])
+def test_eb_line_zorder():
+ x = range(10)
+
+ # First illustrate basic pyplot interface, using defaults where possible.
+ fig = plt.figure()
+ ax = fig.gca()
+ ax.plot(x, lw=10, zorder=5)
+ ax.axhline(1, color='red', lw=10, zorder=1)
+ ax.axhline(5, color='green', lw=10, zorder=10)
+ ax.axvline(7, color='m', lw=10, zorder=7)
+ ax.axvline(2, color='k', lw=10, zorder=3)
+
+ ax.set_title("axvline and axhline zorder test")
+
+ # Now switch to a more OO interface to exercise more features.
+ fig = plt.figure()
+ ax = fig.gca()
+ x = range(10)
+ y = np.zeros(10)
+ yerr = range(10)
+ ax.errorbar(x, y, yerr=yerr, zorder=5, lw=5, color='r')
+ for j in range(10):
+ ax.axhline(j, lw=5, color='k', zorder=j)
+ ax.axhline(-j, lw=5, color='k', zorder=j)
+
+ ax.set_title("errorbar zorder test")