Skip to main content

Module util

Module util 

Source

Functions§

extended_breaks
Extended-Wilkinson tick locations (Talbot, Lin & Hanrahan 2010), matching R’s scales::extended_breaks() / labeling::extended(). Returns “nice” break values covering [dmin, dmax] with roughly m labels.
format_number
Format a number nicely, removing trailing zeros.
is_degenerate_range
True when [dmin, dmax] is too narrow, relative to its magnitude, to place distinct ticks on (floating-point noise around a constant value).
nice_step
Round step size to a “nice” value (1, 2, 5, 10, 20, 50, …).
stepped_breaks
Evenly spaced break values start, start+step, … up to end (inclusive, with a small tolerance). Index-driven and capped, so it terminates even when step is below the floating-point resolution of start (where repeated v += step would never advance).