Skip to main content

Crate plotkit_polars

Crate plotkit_polars 

Source
Expand description

Polars integration for plotkit.

This crate activates Polars support in plotkit-core, providing IntoSeries and IntoCategories implementations for Polars Series. Depend on this crate (or enable the polars feature on the plotkit umbrella crate) to pass Polars data directly to any plotkit charting function.

§Supported types

TypeConversion
&Series (numeric: f64, f32, i32, i64, u32, u64)O(n) cast to f64, nulls become NAN
Series (numeric, owned)delegates to borrowed impl
&Series (string / Utf8)O(n) extraction to Vec<String>, nulls become "null"

§Examples

use polars::prelude::*;
use plotkit_core::series::IntoSeries;

let s = Series::new("values".into(), &[1.0_f64, 2.0, 3.0]);
let plotkit_series = (&s).into_series();
assert_eq!(plotkit_series.data, vec![1.0, 2.0, 3.0]);

Re-exports§

pub use polars;

Structs§

Series
A sequence of f64 values representing one dimension of chart data.

Traits§

IntoCategories
Trait for types that can be converted into Categories.
IntoSeries
Trait for types that can be converted into a Series.