qis.plot_classification_scatter¶
- qis.plot_classification_scatter(df, x=None, y=None, hue_name='hue', num_buckets=None, bins=array([-3., -1.5, 0., 1.5, 3.]), order=1, title=None, full_sample_order=3, markersize=10, xvar_format='{:.2f}', yvar_format='{:.2f}', fit_intercept=False, ax=None, **kwargs)[source]¶
x-y scatter with the sample split into buckets of x, and a fit within each bucket.
A specialisation of
plot_scatter()where the grouping variable is not a separate column butxitself, bucketed. Use it to see whether the y-on-x relationship changes with the level of x — a conditional beta, in other words — without having to construct the classification column by hand.Arguments shared with every
plot_*function are documented inqis/docs/plotting_kwargs.md.- Parameters:
df (DataFrame) – data to plot;
xandyname its columnsx (str | None) – column bucketed and used for the horizontal axis. None takes the first column
y (str | None) – column for the vertical axis. None takes the second column
hue_name (str) – name given to the generated bucket column, which appears as the legend title
num_buckets (int | None) – split x into this many equally populated quantile buckets. None uses
binsinsteadbins (ndarray) – explicit bucket edges in units of x, used when
num_bucketsis None. The default cuts at -3, -1.5, 0, 1.5, 3, which suits a standardised variableorder (int) – polynomial degree of the fit within each bucket
full_sample_order (int | None) – polynomial degree of the fit across the whole sample. None fits none
fit_intercept (bool) – fit an intercept in each regression
title (str)
markersize (int)
xvar_format (str)
yvar_format (str)
ax (Axes)
- Returns:
the figure drawn on, or None when
axwas supplied- Return type:
Figure | None