Reference / binference.plotting.plot_population
binference.plotting.plot_population¶
- binference.plotting.plot_population(result, ax=None, *, which='density', levels=(0.68, 0.95), truth=None, stack=None, color=None, sample_color=None, label=None, alpha=0.25, step=True)[source]¶
Plot a population posterior: bands for 1-D bins, images for 2-D grids, bars for categories.
Overlays (
truth,stack) contribute only their shape: for rates (and rate models) they are scaled to the posterior mean total; for the selected population they are reweighted by the fit’s selection (bins without a basis). 2-D grids show the median and the relative uncertainty as images (an array of two axes) and take no overlays.- Parameters:
- resultPopulationResult or PointEstimate
- axmatplotlib Axes, optional
Axes to draw on;
Nonemakes a new figure.- which{“density”, “fractions”, “rates”, “selected”}
Plot densities per unit volume (n(z)-style), fractions per bin, rates, or the selected population per bin (the singular spellings are accepted too).
- levelssequence of float
Central credible levels shown as nested bands.
- trutharray_like (K,), optional
True fractions to overlay.
- stackarray_like (K,), optional
A naive stacked estimate to overlay (see
Likelihoods.stack).- colormatplotlib colour, optional
Colour of the posterior;
Nonetakes the style’s first colour.- sample_colormatplotlib colour, optional
Colour of the
stackoverlay;Nonetakes the style’s second colour.- labelstr, optional
Legend label of the median (default “posterior median”).
- alphafloat
Opacity of each credible band.
- stepbool
Draw 1-D bins as steps (True) or as lines through the bin centres.