Skip to content

Commit c68d6df

Browse files
committed
fix: correct labels in legend
1 parent 0a62e63 commit c68d6df

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/mplhep/plot.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,14 @@ def iterable_not_string(arg):
310310
return_artists: list[StairsArtists | ErrorBarArtists] = []
311311
if histtype == "step":
312312
for i in range(len(plottables)):
313+
do_errors = yerr is not False and (
314+
(yerr is not None or w2 is not None)
315+
or (plottables[i].variances is not None)
316+
)
317+
313318
_kwargs = _chunked_kwargs[i]
314-
_label = _labels[i]
315-
_step_label = _label if (yerr is None and w2 is None) else None
319+
_label = _labels[i] if do_errors else None
320+
_step_label = _labels[i] if not do_errors else None
316321
_kwargs = soft_update_kwargs(_kwargs, {"linewidth": 1.5})
317322

318323
_plot_info = plottables[i].to_stairs()
@@ -322,11 +327,7 @@ def iterable_not_string(arg):
322327
label=_step_label,
323328
**_kwargs,
324329
)
325-
326-
do_errors = yerr is not False and (
327-
(yerr is not None or w2 is not None)
328-
or (plottables[i].variances is not None)
329-
)
330+
330331
if do_errors:
331332
_kwargs = soft_update_kwargs(_kwargs, {"color": _s.get_edgecolor()})
332333
_kwargs["linestyle"] = "none"

src/mplhep/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ def sqrt_method(values, _):
194194
return values - np.sqrt(values), values + np.sqrt(values)
195195

196196
def calculate_relative(method_fcn, variances):
197-
print("X", np.abs(method_fcn(self.values, variances) - self.values))
198197
return np.abs(method_fcn(self.values, variances) - self.values)
199198

200199
if method == "sqrt":

0 commit comments

Comments
 (0)