mplhep icon indicating copy to clipboard operation
mplhep copied to clipboard

feat: added bar type + correct legend for step type

Open 0ctagon opened this issue 1 year ago • 2 comments

Part of the merging project, linked to this PR in plothist.

This PR adds:

  1. Two new histtype: bar and barstep, which behave like matplotlib: if one histogram is provided bar and barstep are equivalent to fill and step. If multiple are provided, the bars or step are arranged side by side. The barstep can also display y error bars (see tests/baseline/test_histplot_types.png and tests/baseline/test_histplot_bar.png)
  2. The step type has now the same representation in the legend as in matplotlib.
  3. By default, yerr is not shown for step type.

@andrzejnovak @jonas-eschle

0ctagon avatar Oct 20 '24 06:10 0ctagon

This is great! I think we don't want to change the default behaviour of yerr for step. We had a discussion on the topic in the past and iirc the conclusion was that we want to let the user "know" right away if the object has that kind of information.

andrzejnovak avatar Oct 23 '24 22:10 andrzejnovak

I understand the reason and I reverted back to how it was before. As matplotlib doesn't really support step with errorbar, in plothist we would represent them with what corresponds to the band type in mplhep. I think we will need a good section in the doc on how the errors are handled and displayed (in the current plothist doc, everything is boost-histogram so everything has errors already, which overloads a bit all the plots with yerr=True by default).

0ctagon avatar Oct 24 '24 09:10 0ctagon

If necessary we could add an argument to change the legend to a rectangle, but lets get the request first.

0ctagon avatar Oct 29 '24 09:10 0ctagon