scikit-hep / cabinetry

design and steer profile likelihood fits
https://cabinetry.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
27 stars 21 forks source link

feat: support custom colors for data/MC plots #399

Closed alexander-held closed 1 year ago

alexander-held commented 1 year ago

Adding a new colors argument to visualize.data_mc and visualize.data_mc_from_histograms (as well as visualize.plot_model.data_mc) that allows specifying color names per sample: colors={"signal": "red", "background": "blue"}. Colors need to be provided for all samples, otherwise an exception is raised. If colors are invalid, an exception will later on be raised via matplotlib. The default behavior is unchanged, falling back to the seaborn-colorblind colors.

visualize.data_mc_from_histograms was still missing the channels kwarg, this is now also included.

* support custom histogram colors for visualize.data_mc via new colors keyword argument
* support custom histogram colors in visualize.plot_model.data_mc
* extend color and channel filtering functionality to visualize.data_mc_from_histograms

resolves #381 (rest of that issue migrated to #265)

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (d761e30) 100.00% compared to head (44c2666) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #399 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 23 23 Lines 2066 2078 +12 Branches 327 334 +7 ========================================= + Hits 2066 2078 +12 ``` | [Impacted Files](https://codecov.io/gh/scikit-hep/cabinetry/pull/399?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep) | Coverage Δ | | |---|---|---| | [src/cabinetry/visualize/\_\_init\_\_.py](https://codecov.io/gh/scikit-hep/cabinetry/pull/399?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep#diff-c3JjL2NhYmluZXRyeS92aXN1YWxpemUvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [src/cabinetry/visualize/plot\_model.py](https://codecov.io/gh/scikit-hep/cabinetry/pull/399?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep#diff-c3JjL2NhYmluZXRyeS92aXN1YWxpemUvcGxvdF9tb2RlbC5weQ==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.