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

feat: support for publication information in exp_text method #465

Closed yimuchen closed 9 months ago

yimuchen commented 9 months ago

For plots aimed for supplementary materials, CMS requires that the publication information (ex. arXiv number or similar) be added to the plot. See here [1]

Can we add an extra field to the exp_text method to allow for this format? I'm thinking it should be implementing a new set of loc3_dict [2] and additional offset parsing [3] as with what is done for the main label.

I can work on this, but it might take me a bit to converge on a nice set of defaults. (Also not sure what the best action would be for the 'llabel' interactions with the exp_label method).

[1] CMS internal link: https://twiki.cern.ch/twiki/bin/viewauth/CMS/Internal/FigGuidelines [2] https://github.com/scikit-hep/mplhep/blob/master/src/mplhep/label.py#L82 [3] https://github.com/scikit-hep/mplhep/blob/master/src/mplhep/label.py#L151

andrzejnovak commented 9 months ago

Thanks for opening this @yimuchen. Perhaps this would also be a good time to rediscuss the "supplementary" labelling recommendations since the examples in [1] look a bit misaligned.

I agree that the way to include this in mplhep would likely be by including a via a new loc_dict and maybe a new miniclass like the ExpText [4] but SuppText

[4] https://github.com/scikit-hep/mplhep/blob/master/src/mplhep/label.py#L19

yimuchen commented 9 months ago

Adding a first iteration (only works well with loc=2 for now, other locations are prone to overlaps). Might let me know if this is something worth continued work on (or if there is another direction we should go in)

https://github.com/scikit-hep/mplhep/pull/466

yimuchen commented 9 months ago

Completed in PR https://github.com/scikit-hep/mplhep/pull/466