diff --git a/docs/changelog.md b/docs/changelog.md index 2f9ab9ab..f3f3c032 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,19 @@ # Changelog +## Version 2.6.2 + +* Nicer stacks repr + [#449](https://github.com/scikit-hep/hist/pull/449) +* Backport `storage_type` if boost-histogram < 1.3.2 + [#447](https://github.com/scikit-hep/hist/pull/447) +* Allow overwriting labels for plot/overlay + [#414](https://github.com/scikit-hep/hist/pull/414) +* Use Hatching to build the package + [#418](https://github.com/scikit-hep/hist/pull/418) +* Support git archival version numbers + [#441](https://github.com/scikit-hep/hist/pull/441) + + ## Version 2.6.1 * Fall back on normal repr when histogram is too large diff --git a/src/hist/axis/__init__.py b/src/hist/axis/__init__.py index 537bd119..331336a9 100644 --- a/src/hist/axis/__init__.py +++ b/src/hist/axis/__init__.py @@ -82,7 +82,7 @@ def _repr_args_(self: AxisProtocol) -> list[str]: if self.name: ret.append(f"name={self.name!r}") - if self.label: + if self.label and self.label != self.name: ret.append(f"label={self.label!r}") return ret diff --git a/src/hist/stack.py b/src/hist/stack.py index 1139698a..af29b3d1 100644 --- a/src/hist/stack.py +++ b/src/hist/stack.py @@ -111,8 +111,9 @@ def __len__(self) -> int: return len(self._stack) def __repr__(self) -> str: - str_stack = ", ".join(repr(h) for h in self) - return f"{self.__class__.__name__}({str_stack})" + names = ", ".join(repr(getattr(h, "name", f"H{i}")) for i, h in enumerate(self)) + h = repr(self[0]) if len(self) else "Empty stack" + return f"{self.__class__.__name__}<({names}) of {h}>" def __eq__(self, other: Any) -> bool: if not isinstance(other, Stack):