Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 764a541 + af904fc commit ade25fbCopy full SHA for ade25fb
2 files changed
lib/matplotlib/axes/_axes.py
@@ -2969,7 +2969,7 @@ def extract_err(err, data):
2969
# select points without upper/lower limits in x and
2970
# draw normal errorbars for these points
2971
noxlims = ~(xlolims | xuplims)
2972
- if noxlims.any():
+ if noxlims.any() or len(noxlims) == 0:
2973
yo, _ = xywhere(y, right, noxlims & everymask)
2974
lo, ro = xywhere(left, right, noxlims & everymask)
2975
barcols.append(self.hlines(yo, lo, ro, **eb_lines_style))
@@ -3018,7 +3018,7 @@ def extract_err(err, data):
3018
# select points without upper/lower limits in y and
3019
3020
noylims = ~(lolims | uplims)
3021
- if noylims.any():
+ if noylims.any() or len(noylims) == 0:
3022
xo, _ = xywhere(x, lower, noylims & everymask)
3023
lo, uo = xywhere(lower, upper, noylims & everymask)
3024
barcols.append(self.vlines(xo, lo, uo, **eb_lines_style))
lib/matplotlib/tests/test_axes.py
@@ -5412,3 +5412,10 @@ def test_polar_gridlines():
5412
5413
assert ax.xaxis.majorTicks[0].gridline.get_alpha() == .2
5414
assert ax.yaxis.majorTicks[0].gridline.get_alpha() == .2
5415
+
5416
5417
+def test_empty_errorbar_legend():
5418
+ fig, ax = plt.subplots()
5419
+ ax.errorbar([], [], xerr=[], label='empty y')
5420
+ ax.errorbar([], [], yerr=[], label='empty x')
5421
+ ax.legend()
0 commit comments