hist.basehist module#
- class hist.basehist.BaseHist(arg: dict[str, Any], /, *, data: ndarray[tuple[Any, ...], dtype[Any]] | None = ..., metadata: Any = ..., label: str | None = ..., name: str | None = ...)#
- class hist.basehist.BaseHist(arg: Self | Histogram[S], /, *, data: ndarray[tuple[Any, ...], dtype[Any]] | None = ..., metadata: Any = ..., label: str | None = ..., name: str | None = ...)
- class hist.basehist.BaseHist(*axes: AxisProtocol | tuple[int, float, float] | Storage | str, storage: S = ..., metadata: Any = ..., data: ndarray[tuple[Any, ...], dtype[Any]] | None = ..., label: str | None = ..., name: str | None = ...)
Bases:
Histogram[S],Generic[S]- fill(*args: Any, weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#
Insert data into the histogram using names and indices, return a Hist object.
- fill_flattened(*args: Any, weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#
- classmethod from_columns(data: Mapping[str, Any], axes: Sequence[str | AxisProtocol], *, weight: str | None = None, storage: Storage = Double()) Self#
- integrate(name: int | str, i_or_list: list[str | int], j: InnerIndexing | None = None) Self#
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) IntHists | int
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) FloatHists | float
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) ListHists | list[float]
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) WeightHists | WeightedSum
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) MeanHists | Mean
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) WeightedMeanHists | WeightedMean
- integrate(name: int | str, i_or_list: InnerIndexing | None = None, j: InnerIndexing | None = None) Self | int | float | list[float] | Any
- plot(*args: Any, overlay: str | None = None, **kwargs: Any) Hist1DArtists | Hist2DArtists#
Plot method for BaseHist object.
- plot1d(*, ax: matplotlib.axes.Axes | None = None, overlay: str | int | None = None, legend: bool = True, **kwargs: Any) Hist1DArtists#
Plot1d method for BaseHist object.
- Parameters:
ax (matplotlib.axes.Axes, optional) – Axes to plot on. If None, uses current axes or creates new ones.
overlay (str or int, optional) – Name or index of the axis to overlay. If None, automatically selects the first discrete axis for multi-dimensional histograms.
legend (bool, default True) – Whether to automatically add a legend when plotting stacked categories. The legend title is set from the axis label if available.
**kwargs (Any) – Additional keyword arguments passed to the underlying plot functions.
- Returns:
The matplotlib artists created by the plot.
- Return type:
Hist1DArtists
- plot2d(*, ax: matplotlib.axes.Axes | None = None, **kwargs: Any) Hist2DArtists#
Plot2d method for BaseHist object.
- plot2d_full(*, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[Hist2DArtists, Hist1DArtists, Hist1DArtists]#
Plot2d_full method for BaseHist object.
Pass a dict of axes to
ax_dict, otherwise, the current figure will be used.
- plot_pull(func: Callable[[np.typing.NDArray[Any]], np.typing.NDArray[Any]] | str, *, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[FitResultArtists, RatiolikeArtists]#
plot_pullmethod forBaseHistobject.Return a tuple of artists following a structure of
(main_ax_artists, subplot_ax_artists)
- plot_ratio(other: hist.BaseHist[Any] | Callable[[np.typing.NDArray[Any]], np.typing.NDArray[Any]] | str, *, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[MainAxisArtists, RatiolikeArtists]#
plot_ratiomethod forBaseHistobject.Return a tuple of artists following a structure of
(main_ax_artists, subplot_ax_artists)
- profile(axis: int | str) Self#
Returns a profile (Mean/WeightedMean) histogram from a normal histogram with N-1 axes. The axis given is profiled over and removed from the final histogram.