2. Concepts

Data Source
Ezel's APIs expect polars::frame::DataFrame
as a data source.
If you have other data types, they should be converted to DataFrame
first.
use ezel::prelude::*;
use polars::prelude::*;
let mut x = vec![..];
let mut y = vec![..];
let df = df!(
"x" => &x,
"y" => &y
)
.unwrap();
let mut plot = Cartesian2::default();
plot.scatter(df, Column("x".to_string()), Column("y".to_string()));
More ergonomic interfaces are planned to be added.
let x: Vec<f64>;
let y: Vec<f64>;
ezel::quick::scatter_xy(x, y); // Cartesian2 + x + y
let mut plot = Cartesian2::default();
plot.scatter_xy(x, y); // two Vec<f64>
Data Types (i64, f64, ..)
f64
are expected in most places. If you have f32
data, simply convert it to f64
.
Composition
Ezel borrows the idea of protrusion from Makie.jl
. The main areas of items in the grid are aligned by rows and columns.
Composition
TODO
Protrusion
TODO
Attribute
Attributes are the properties of plots such as marker size, color, etc.
There are 3 types of attribute value: a const, categorical column, or scalar column.
marker_size: ConstOrScalar<f64>, // const or scalar
marker_shape: ConstOrCategorical<MarkerShape>, // const or categorical
marker_color: ConstOrColumn<Color>, // const or categorical or scalar
scatter.marker.size = Const(10.0)
means all markers have the same size 10.0.
If you want to use a f64 column in polars' DataFrame as categorical data, the easiest way is to cast it to the string dtype.
Last updated