Home

retbins

Retbins is a parameter used in histogram plotting functions to request that the function return the bin edges used for binning the data. It is most commonly associated with Matplotlib's pyplot.hist function. When retbins is True, the function includes the computed bin boundaries in its returned data along with the histogram counts. The bin edges delimit the intervals that compose the histogram and are useful for mapping values to bins, labeling plots, or performing further analysis.

Usage: Example: data = [...] plt.hist(data, bins=30, retbins=True). This call returns the histogram counts and the bin edges,

Notes: The bin edges are the coordinates of the bin boundaries along the x-axis. Retbins helps situations

See also: histogram, bin, bin edge, binning, matplotlib.

allowing
the
caller
to
reuse
the
exact
bin
boundaries
for
other
calculations.
The
exact
return
signature
may
include
patch
objects
depending
on
the
backend
and
version.
where
the
code
later
needs
to
reference
the
same
bin
edges,
for
instance
to
annotate
a
chart
or
to
join
with
other
datasets
that
share
the
same
binning.
The
option
is
library-specific
and
not
a
universal
property
of
all
histogram
implementations;
other
libraries
may
use
different
mechanisms
to
expose
bin
edges.