Skip to main content

format_numbers

Function format_numbers 

Source
pub fn format_numbers(values: &[f64]) -> Vec<String>
Expand description

Format a number nicely, removing trailing zeros. Format a set of break values together: like format_number (integers verbatim, otherwise up to 2 decimals, trailing zeros trimmed), but with as many extra decimals as needed so that distinct breaks get distinct labels and no non-zero break prints as “0” — e.g. breaks 0.990/0.992/0.994 read “0.99, 0.992, 0.994” instead of “0.99, 0.99, 0.99”, and a log tick at 0.001 no longer reads “0”. Output is unchanged whenever 2 decimals suffice.