plotkit 0.5.0

A matplotlib-shaped, publication-quality plotting library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Bar chart example.

use plotkit::prelude::*;

fn main() -> plotkit::Result<()> {
    let categories = vec!["A", "B", "C", "D", "E"];
    let values = vec![23.0, 45.0, 12.0, 67.0, 34.0];

    let mut fig = Figure::with_size(800, 600);
    let ax = fig.add_subplot(1, 1, 1);
    ax.bar(categories.as_slice(), &values)?;
    ax.set_title("Bar Chart");
    ax.set_ylabel("Value");
    fig.save("examples/output/03_bar.png")?;
    Ok(())
}