dabl.plot.class_hists

dabl.plot.class_hists(data, column, target, bins='auto', ax=None, legend=True, scale_separately=True)[source]

Grouped univariate histograms.

Parameters:
datapandas DataFrame

Input data to plot.

columncolumn specifier

Column in the data to compute histograms over (must be continuous).

targetcolumn specifier

Target column in data, must be categorical.

binsstring, int or array-like

Number of bins, ‘auto’ or bin edges. Passed to np.histogram_bin_edges. We always show at least 5 bins for now.

axmatplotlib axes

Axes to plot into.

legendboolean, default=True

Whether to create a legend.

scale_separatelyboolean, default=True

Whether to scale each class separately.

Examples

>>> from dabl.datasets import load_adult
>>> data = load_adult()
>>> class_hists(data, "age", "gender", legend=True)
<Axes: xlabel='age'>