Skip to content

Commit

Permalink
fix: prematurely exhausting all generator arguments passed to hist plot.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhw3 committed Oct 3, 2023
1 parent ad565e7 commit 8a7ea58
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/mplhep/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,11 @@ def iterable_not_string(arg):
# Check if iterable
if iterable_not_string(kwargs[kwarg]):
# Check if tuple of floats or ints (can be used for colors)
all_entries_numerical = all(
isinstance(x, int) or isinstance(x, float) for x in kwargs[kwarg]
)
if isinstance(kwargs[kwarg], tuple) and all_entries_numerical:
for i in range(len(_chunked_kwargs)):
_chunked_kwargs[i][kwarg] = kwargs[kwarg]
if isinstance(kwargs[kwarg], tuple):
all_entries_numerical = all(isinstance(x, int) or isinstance(x, float) for x in kwargs[kwarg])
if all_entries_numerical:
for i in range(len(_chunked_kwargs)):
_chunked_kwargs[i][kwarg] = kwargs[kwarg]
else:
for i, kw in enumerate(kwargs[kwarg]):
_chunked_kwargs[i][kwarg] = kw
Expand Down

0 comments on commit 8a7ea58

Please sign in to comment.