diff --git a/docs/changelog.md b/docs/changelog.md index 2a97d5ce..017cb536 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,10 @@ # Changelog +## WIP + +* Support IntCat for plot1d overlay + [#419](https://github.com/scikit-hep/hist/pull/419) + ## Version 2.7.3 This release fixes an issue with Python 3.12 pulling in NumPy 2 pre-releases. diff --git a/src/hist/basehist.py b/src/hist/basehist.py index 027cb320..358d2ef4 100644 --- a/src/hist/basehist.py +++ b/src/hist/basehist.py @@ -502,8 +502,9 @@ def plot1d( (overlay,) = (i for i, ax in enumerate(self.axes) if ax.traits.discrete) assert overlay is not None cat_ax = self.axes[overlay] - cats = cat_ax if cat_ax.traits.discrete else np.arange(len(cat_ax.centers)) - d1hists = [self[{overlay: cat}] for cat in cats] + icats = np.arange(len(cat_ax)) + cats = cat_ax if cat_ax.traits.discrete else icats + d1hists = [self[{overlay: cat}] for cat in icats] if "label" in kwargs: if not isinstance(kwargs["label"], str) and len(kwargs["label"]) == len( cats