plot_math
plot_math
¶
Scalar transformations and formatting shared by browser plots.
transform_points(points: tuple[tuple[float, float], ...], log_x: bool, log_y: bool) -> list[tuple[float, float]]
¶
Transform finite points into the selected linear or log domains.
interpolate(points: list[tuple[float, float]], x: float) -> float | None
¶
Interpolate a connected series at x, clamping to its endpoints.
twema(points: tuple[tuple[float, float], ...], smoothing: float) -> tuple[tuple[float, float], ...]
¶
Apply debiased time-weighted EMA using normalized x spacing.
format_tick(value: float) -> str
¶
Format an axis value with compact uppercase magnitude suffixes.
format_timestamp(value: float) -> str
¶
Format a stored timestamp in local time for detailed display.
format_timestamp_tick(value: float, span: float) -> str
¶
Format a compact local-time label appropriate to an axis span.
format_field(key: str, value: float) -> str
¶
Format a plotted field according to its semantic type.
ticks(low: float, high: float, logarithmic: bool, count: int, formatter: Callable[[float], str] | None = None) -> tuple[tuple[float, str], ...]
¶
Return well-spaced normalized tick positions and original-unit labels.