_validate_figsize

Signature

_validate_figsize(figsize: ArrayLike) -> tuple[float, float]

What problem it solves

Checks that figsize is a valid pair of positive dimensions before creating a matplotlib figure.

Input contract

  • figsize must be a sequence of two elements.

  • It cannot be a string or a bytes object.

  • Both values must be finite and strictly positive.

Where it is used

  • in histogram when the figure is created internally

  • in lin_fit when show_plot=True

Failure modes

  • ValueError if figsize is not a pair

  • ValueError if one of the values is not numeric, not finite, or not positive

Why it stays private

It avoids duplicating the same check throughout the plotting code, but it does not add a standalone concept for the end user.