Skip to main content

quick_plot

Function quick_plot 

Source
pub fn quick_plot(
    x_data: &[f64],
    y_data: &[f64],
    title: Option<&str>,
    x_label: Option<&str>,
    y_label: Option<&str>,
    width: usize,
    height: usize,
) -> String
Expand description

Quick one-shot plot of a line series. Returns the rendered string.

For the full builder API, see LinePlot and Layout2D.

ยงExamples

let xs: Vec<f64> = (0..=30).map(|i| i as f64 / 10.0).collect();
let ys: Vec<f64> = xs.iter().map(|x| x.sin()).collect();
let output = ploot::quick_plot(&xs, &ys, Some("sin(x)"), Some("x"), Some("y"), 60, 15);
assert!(output.contains("sin(x)"));