uproot.behaviors.TAxis.TAxis

Defined in uproot.behaviors.TAxis on line 42.

class uproot.behaviors.TAxis.TAxis

Describes a histogram axis.

traits

TAxis.traits

Describes read-only properties of a histogram axis.

For example, axis.traits.discrete is True if the histogram has labels; False otherwise.

low

TAxis.low

The low edge of the first normal (finite-width) bin.

For ROOT histograms, numerical edges exist even if the axis also has string-valued labels.

high

TAxis.high

The high edge of the last normal (finite-width) bin.

For ROOT histograms, numerical edges exist even if the axis also has string-valued labels.

width

TAxis.width

The average bin width (or only bin width if the binning is uniform).

labels

TAxis.labels(flow=False)
Parameters:

flow (bool) – If True, include "underflow" and "overflow" before and after the normal (finite-width) bin labels (if they exist).

If string-valued labels exist, this returns them as a Python list of Python strings. Otherwise, this returns None.

Setting flow=True increases the length of the output by two.

edges

TAxis.edges(flow=False)
Parameters:

flow (bool) – If True, include -inf and inf before and after the normal (finite-width) bin edges.

Returns numerical edges between bins as a one-dimensional numpy.ndarray of numpy.float64.

Even with flow=False, the number of edges is one greater than the number of normal (finite-width) bins because they represent “fenceposts” between the bins, including one below and one above the full range.

Setting flow=True increases the length of the output by two.

For ROOT histograms, numerical edges exist even if the axis also has string-valued labels.

intervals

TAxis.intervals(flow=False)
Parameters:

flow (bool) – If True, include [-inf, min] and [max, inf] before and after the normal (finite-width) intervals.

Returns low, high pairs for each bin interval as a two-dimensional numpy.ndarray of numpy.float64.

With flow=False, the number of intervals is equal to the number of normal (finite-width) bins.

Setting flow=True increases the length of the output by two.

For ROOT histograms, numerical intervals exist even if the axis also has string-valued labels.

centers

TAxis.centers(flow=False)
Parameters:

flow (bool) – If True, include -inf and inf before and after the normal (finite) bin centers.

Returns bin center positions as a one-dimensional numpy.ndarray of numpy.float64.

With flow=False, the number of bin centers is equal to the number of normal (finite-width) bins.

Setting flow=True increases the length of the output by two.

For ROOT histograms, numerical bin centers exist even if the axis also has string-valued labels.

widths

TAxis.widths(flow=False)
Parameters:

flow (bool) – If True, include -inf and inf before and after the normal (finite) bin widths.

Returns bin widths as a one-dimensional numpy.ndarray of numpy.float64.

With flow=False, the number of bin widths is equal to the number of normal (finite-width) bins.

Setting flow=True increases the length of the output by two.

For ROOT histograms, numerical bin widths exist even if the axis also has string-valued labels.