Crates.io | plt |
lib.rs | plt |
version | 0.4.1 |
source | src |
created_at | 2022-08-25 00:31:21.528549 |
updated_at | 2022-11-18 17:26:12.201164 |
description | Plotting library with a focus on publication level aesthetics and ergonomic control. |
homepage | |
repository | https://github.com/plt-rs/plt |
max_upload_size | |
id | 651848 |
size | 359,110 |
A plotting library with a focus on publication level aesthetics and ergonomic control.
Subplot
.Layout
.Figure
, which is used to draw to a file or directly to a Backend
.To get started, see the examples directory in the main repository.
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();
Currently, the only implemented backend depends on Cairo.
apt install libcairo2-dev
pacman -Syu cairo