Expand description
ndarray integration for plotkit.
This crate activates ndarray support in plotkit-core, providing
IntoSeries implementations for
common ndarray one-dimensional array types. Depend on this crate (or
enable the ndarray feature on the plotkit umbrella crate) to pass
ndarray arrays directly to any plotkit charting function.
§Supported types
| Type | Conversion |
|---|---|
&Array1<f64> / Array1<f64> | zero-copy (contiguous slice borrow) |
ArrayView1<'_, f64> | zero-copy when contiguous, O(n) copy when strided |
&Array1<f32> / Array1<f32> | O(n) widening cast |
&Array1<i32> / Array1<i32> | O(n) cast to f64 |
&Array1<i64> / Array1<i64> | O(n) cast to f64 |
ArrayView1<'_, f32/i32/i64> | O(n) cast to f64 |
§Examples
use ndarray::array;
use plotkit_core::series::IntoSeries;
let arr = array![1.0, 2.0, 3.0];
let series = (&arr).into_series();
assert_eq!(series.data, vec![1.0, 2.0, 3.0]);Re-exports§
pub use ndarray;
Structs§
- Series
- A sequence of
f64values representing one dimension of chart data.
Traits§
- Into
Series - Trait for types that can be converted into a
Series.