use charton::prelude::*;
use polars::prelude::*;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let df = df! [
"type" => [1.2, 2.2, 3.0, 4.1],
"value" => [4.9, 5.3, 5.5, 6.5],
"value_std" => [0.2, 0.23, 0.14, 0.25]
]?;
Chart::build(&df)?
.transform_calculate(
(col("value") - col("value_std")).alias("value_min"), (col("value") + col("value_std")).alias("value_max"), )?
.mark_errorbar()?
.encode((x("type"), y("value_min"), y2("value_max")))?
.coord_flip()
.save("docs/src/images/errorbar.svg")?;
Ok(())
}