Getting Started

Setup

[dependencies]
ezel = "*"

Simple Plot

fn main() {
  let plot = ezel::Cartesian2::new();
  plot.x_axis.label = Some("X axis".to_string());
  plot.y_axis.label = Some("Y value".to_string());
  plot.scatter(Data2{});
  plot.save_to_file("example.png").unwrap();
}

Multi Plot

use piet::Color;

fn main() {
  let node1 = plot_example1();
  let node2 = {
    let mut node = ezel::Grid::new();
    node.push(0, 0, plot_example2());
    node.push_side(0, 0, Side::TopLeft, ezel::PlainBox::new(Color::GREEN));
  };
  let node0 = ezel::Grid::new();
  node0.push(0, 0, node1);
  node0.push(0, 1, node2);
  node0.save_to_file("example.png").unwrap();
}

GG (Grammar of Graphics) API

use ezel::gg;

fn main() {
    let df: polars::DataFrame = ..;
    let plot = gg::Plot::new()
        .data(df)
        .geometry(gg::Geometry::Line)
        .map_x("column1")
        .map_y("column2")
        .map_color("column1")
        .theme(gg::Theme::Matplotlib)
        .build();
    plot.save_to_file("example.png");
}

Last updated