Skip to content

plt-rs/plt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plt

CI Crates.io docs.rs

A plotting library with a focus on publication level aesthetics and ergonomic control.

Structure

  • Plots are drawn on a Subplot.
  • One or more subplots are organized in a Layout.
  • The layout is added to a Figure, which is used to draw to a file or directly to a Backend.

Use

To get started, see the examples directory in the main repository.

Example

use plt::*;

// create data
let xs: Vec<f64> = (0..=100).map(|n: u32| n as f64 * 0.1).collect();
let ys: Vec<f64> = xs.iter().map(|x| x.powi(3)).collect();

// create subplot
let mut sp = Subplot::builder()
    .label(Axes::X, "x data")
    .label(Axes::Y, "y data")
    .build();

// plot data
sp.plot(&xs, &ys).unwrap();

// make figure and add subplot
let mut fig = <Figure>::default();
fig.set_layout(SingleLayout::new(sp)).unwrap();

// save figure to file
fig.draw_file(FileFormat::Png, "example.png").unwrap();

Simple Example

Dependencies

Currently, the only implemented backend depends on Cairo.

Debian / Ubuntu

apt install libcairo2-dev

Arch

pacman -Syu cairo

About

A rust plotting library, intended to make it easy to make publication quality figures.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages