scikit-hep / mplhep

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

feat(histplot): Add "mixed" histtype for stacked histograms #453

Closed rpsimeon34 closed 11 months ago

rpsimeon34 commented 12 months ago

feat(histplot): Add "mixed" option for histtype to allow some filled and one unfilled stacked histogram in one plot

andrzejnovak commented 12 months ago

Welcome @rpsimeon34. Thanks for the PR, but could you walk me through a bit why this should be an included functionality that cannot be obtained otherwise? At first glance this seems very use case specific and not playing super nicely with things like passing the order kwarg.

andrzejnovak commented 12 months ago

In principle this could also achieve you desired effect in one line

hep.histplot(hs, histtype='fill', stack=True, facecolor=['red', 'blue', 'none'], edgecolor=['red', 'blue', 'green'], linewidth=1);

though this also comes with a line at the bottom of the patch

rpsimeon34 commented 12 months ago

Hi @andrzejnovak, I actually wasn't aware that you could pass 'none' as an element in facecolor. The strongest argument I can think of now for including this as a feature is that this allows you to leverage matplotlib's automatic color assignment when plotting a variable-length list of histograms (as opposed to manually naming the colors to include). But, if you think this PR causes more difficulties than it solves, I'm happy to use the facecolor solution instead.

andrzejnovak commented 11 months ago

Sorry for the long delay in replying and thanks for the discussion. I am going to close this for now. Please feel free to open it as an issue later on if the need for this functionality persists and can be argued as an at least somewhat common use case.