rescale_clip_outliers

rescale_clip_outliers(ax: Axes | None = None, calc_outlier_bounds: Callable | Tuple[Callable, Callable] | None = None, *, pad: float = 0.1) None[source]

Rescale the axes of a Matplotlib axes with plotted points to exclude outliers.

This function inspects plotted points already on the axes object.

Parameters:
  • ax (mpl_Axes, optional) –

    The Matplotlib Axes object to rescale.

    If None, plt.gca() will be used.

  • calc_outlier_bounds (Union[Callable, Tuple[Callable, Callable]], optional) –

    A function or a tuple of two functions to calculate the outlier bounds for the x and y data points.

    Each function should accept an array of data points and return a tuple of (lower, upper) bounds. If None, defaults to interquartile range-based calculation (CalcBoundsIQR with multiplier 1.5).

  • pad (float, default 0.1) – How far should axes limits be padded beyond the non-outlier data range?

Return type:

None

Notes

In cases where there are no outliers or all points are outliers, axes limits will not be adjusted In cases where non-outliers take on only a single value, padding will be applied relative to that value or, if zero, one.