diff --git a/src/mplhep/plot.py b/src/mplhep/plot.py index ea4b9caf..d24083ed 100644 --- a/src/mplhep/plot.py +++ b/src/mplhep/plot.py @@ -416,6 +416,7 @@ def iterable_not_string(arg): if do_errors: _kwargs = soft_update_kwargs(_kwargs, {"color": _s.get_edgecolor()}) + _ls = _kwargs.pop("linestyle", "-") _kwargs["linestyle"] = "none" _plot_info = plottables[i].to_errorbar() _e = ax.errorbar( @@ -423,7 +424,7 @@ def iterable_not_string(arg): **_kwargs, ) _e_leg = ax.errorbar( - [], [], yerr=1, xerr=1, color=_s.get_edgecolor(), label=_label + [], [], yerr=1, xerr=None, color=_s.get_edgecolor(), label=_label, linestyle=_ls ) return_artists.append( StairsArtists( diff --git a/tests/test_mock.py b/tests/test_mock.py index f275c62e..d9db3e1a 100644 --- a/tests/test_mock.py +++ b/tests/test_mock.py @@ -56,7 +56,8 @@ def test_simple(mock_matplotlib): approx([]), approx([]), yerr=1, - xerr=1, + xerr=None, + linestyle='-', color=ax.stairs().get_edgecolor(), label="X", )