scikit-hep / mplhep

Extended histogram plotting on top of matplotlib and HEP collaboration compatible styling
https://mplhep.readthedocs.io
MIT License
189 stars 66 forks source link

fix: _chunked_kwargs not expanding kwargs if they're tuples even if t… #448

Closed jjhw3 closed 1 year ago

jjhw3 commented 1 year ago

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

This issue confused me for a long time and is likely to come up if one uses the 'zip' builtin to zip up colours and histograms. Although this could be fixed by simply converting the tuple of colors returned by zip into a list, this is a better solution as it does not require users to read the source code to figure this out.

jjhw3 commented 1 year ago

Before this fix, the following would not work (note the tuple of colors), now it does:

hs = [hist.new.Reg(10,0,10).Weight().fill(np.random.normal(3+i, 1, 1000)) for i in range(3)] hep.histplot(hs, histtype='fill', stack=True, color=('red', 'blue', 'firebrick'));

andrzejnovak commented 1 year ago

Ah, looks good. Thanks for the fix!