-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Hi,
histplot
crashes when plotting histograms with a single bin, when trying to draw overflow bins.
Reproducer :
import hist
import mplhep as hep
h = hist.Hist(hist.axis.Regular(1, 0, 1))
h.fill([-1, 0.5])
hep.histplot(h)
Output
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[17], line 1
----> 1 hep.histplot(h)
File [***/lib/python3.10/site-packages/mplhep/plot.py:532], in histplot(H, bins, yerr, w2, w2method, stack, density, binwnorm, histtype, xerr, label, sort, edges, binticks, ax, flow, **kwargs)
528 if underflow > 0.0:
529 if flow == "hint":
530 ax.plot(
531 [
--> 532 final_bins[0] - (final_bins[-3] - final_bins[2]) * 0.03,
533 final_bins[0],
534 ],
535 [0, 0],
536 **kwargs,
537 )
538 if flow == "show":
539 ax.plot(
540 [flow_bins[1], flow_bins[2]],
541 [0, 0],
542 **kwargs,
543 )
IndexError: index -3 is out of bounds for axis 0 with size 2
Metadata
Metadata
Assignees
Labels
No labels