Skip to content

Commit

Permalink
fix: _chunked_kwargs not expanding kwargs if they're tuples even if t… (
Browse files Browse the repository at this point in the history
#448)

* fix: _chunked_kwargs not expanding kwargs if they're tuples even if the tuple isn't a valid mpl color

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jjhw3 and pre-commit-ci[bot] authored Oct 3, 2023
1 parent 82c1e2d commit 826b1aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mplhep/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,11 @@ def iterable_not_string(arg):
for kwarg in kwargs:
# Check if iterable
if iterable_not_string(kwargs[kwarg]):
# Check if tuple (can be used for colors)
if isinstance(kwargs[kwarg], tuple):
# 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]
else:
Expand Down

0 comments on commit 826b1aa

Please sign in to comment.