_validate_axis_limits

Signature

_validate_axis_limits(
    limits: ArrayLike,
    *,
    name: str,
    min_label: str,
    max_label: str,
) -> tuple[float, float]

What problem it solves

Converts and validates a pair of axis or range limits while keeping error messages specific to the parameter that requested them.

Input contract

  • limits must be a sequence of exactly two elements.

  • Strings and bytes are rejected explicitly.

  • Both values must be convertible to float and finite.

Where it is used

Failure modes

  • ValueError if limits is not a valid sequence

  • ValueError if it does not contain exactly two elements

  • ValueError if it contains non-finite values

Why it stays private

It is a support validator for the plotting layer. Its usefulness is internal, but documenting it makes the common plotting rules easier to read.