Ezel
  • Ezel
  • Basics
    • 1. Getting Started
    • 2. Concepts
      • Axis
    • 3. Attributes
    • 4. Cloud
  • Optimization
    • Style Customization
    • Data Lifetime
  • Grammar of Graphics
    • What is GoG
    • Interface
  • plot
    • PlainBox
    • Cartesian2
      • Basics
      • Geometry
    • Cartesian3
    • Text
    • NodeGraph
    • Grid
  • Git Repository
  • crates.io
  • docs.rs
  • pypi
  • Dev
    • Rendering
  • Coordinates
Powered by GitBook
On this page
  • Setup
  • Simple Plot
  • Multi Plot
  • GG (Grammar of Graphics) API
  1. Basics

1. 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");
}
PreviousEzelNext2. Concepts

Last updated 1 year ago