Skip to main content

label_percent_marks

Function label_percent_marks 

Source
pub fn label_percent_marks(
    accuracy: Option<f64>,
    decimal_mark: &str,
    big_mark: &str,
    suffix: &str,
) -> impl Fn(f64) -> String + Send + Sync
Expand description

label_percent with explicit marks and percent suffix ("%", " %"). accuracy is in percentage points (Some(0.1) → one decimal); None matches label_percent.

use ggplot_rs::scale::format::label_percent_marks;
let f = label_percent_marks(None, ",", ".", " %");
assert_eq!(f(0.123), "12,3 %");