plotlars 0.12.0

Plotlars is a Rust library designed to facilitate the integration between the Polars data analysis library and visualization libraries.
use plotlars::polars::prelude::*;
use plotlars::{Axis, CsvReader, Legend, Plot, Rgb, ScatterPlot, Shape, Text, TickDirection};

fn main() {
    let dataset = CsvReader::new("data/penguins.csv")
        .finish()
        .unwrap()
        .lazy()
        .select([
            col("species"),
            col("sex").alias("gender"),
            col("flipper_length_mm").cast(DataType::Int16),
            col("body_mass_g").cast(DataType::Int16),
        ])
        .collect()
        .unwrap();

    let axis = Axis::new()
        .show_line(true)
        .tick_direction(TickDirection::OutSide)
        .value_thousands(true);

    ScatterPlot::builder()
        .data(&dataset)
        .x("body_mass_g")
        .y("flipper_length_mm")
        .group("species")
        .sort_groups_by(|a, b| {
            if a.len() == b.len() {
                a.cmp(b)
            } else {
                a.len().cmp(&b.len())
            }
        })
        .opacity(0.5)
        .size(12)
        .colors(vec![Rgb(178, 34, 34), Rgb(65, 105, 225), Rgb(255, 140, 0)])
        .shapes(vec![Shape::Circle, Shape::Square, Shape::Diamond])
        .plot_title(Text::from("Scatter Plot").font("Arial").size(20).x(0.065))
        .x_title("body mass (g)")
        .y_title("flipper length (mm)")
        .legend_title("species")
        .x_axis(&axis.clone().value_range(2500.0, 6500.0))
        .y_axis(&axis.clone().value_range(170.0, 240.0))
        .legend(&Legend::new().x(0.85).y(0.15))
        .build()
        .plot();
}