From b839bca40167792c3e9314f7df673e326178f812 Mon Sep 17 00:00:00 2001 From: Johannes Schumann Date: Sun, 28 Apr 2024 22:42:30 +0200 Subject: [PATCH 1/3] forward linestyle to _e_leg and remove xerr --- src/mplhep/plot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mplhep/plot.py b/src/mplhep/plot.py index ea4b9caf..131270e7 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["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( From 7f6573c05460b9ef8e9e790ffdb4ab9edb22b4c8 Mon Sep 17 00:00:00 2001 From: Johannes Schumann Date: Mon, 29 Apr 2024 00:47:01 +0200 Subject: [PATCH 2/3] fix exception if no linestyle is given --- src/mplhep/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mplhep/plot.py b/src/mplhep/plot.py index 131270e7..d24083ed 100644 --- a/src/mplhep/plot.py +++ b/src/mplhep/plot.py @@ -416,7 +416,7 @@ def iterable_not_string(arg): if do_errors: _kwargs = soft_update_kwargs(_kwargs, {"color": _s.get_edgecolor()}) - _ls = _kwargs["linestyle"] + _ls = _kwargs.pop("linestyle", "-") _kwargs["linestyle"] = "none" _plot_info = plottables[i].to_errorbar() _e = ax.errorbar( From aa6a077cdf288491b1ff604f3dd0400e70673a80 Mon Sep 17 00:00:00 2001 From: Johannes Schumann Date: Mon, 29 Apr 2024 13:08:41 +0200 Subject: [PATCH 3/3] update test --- tests/test_mock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", )