pub fn barplot<L: ToString, V: ToString>(
labels: &[L],
values: &[V],
options: BarplotOptions,
) -> Result<Plot<BarplotGraphics>, BarplotError>Expand description
Constructs a bar plot from labels and values.
§Examples
use unicode_plot::{barplot, BarplotOptions};
let plot = barplot(
&["apple", "banana", "cherry"],
&[15, 42, 8],
BarplotOptions::default(),
).unwrap();
let mut buf = Vec::new();
plot.render(&mut buf, false).unwrap();
assert!(!buf.is_empty());§Errors
Returns BarplotError::LengthMismatch when input lengths differ,
BarplotError::NegativeValuesUnsupported when a value is negative, and
BarplotError::InvalidNumericValue if a value cannot be parsed as f64.