File: histogram_svg.rs

package info (click to toggle)
rust-plotlib 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 628 kB
  • sloc: sh: 19; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use plotlib::page::Page;
use plotlib::repr::{Histogram, HistogramBins};
use plotlib::style::BoxStyle;
use plotlib::view::ContinuousView;

fn main() {
    let data = [0.3, 0.5, 6.4, 5.3, 3.6, 3.6, 3.5, 7.5, 4.0];
    let h = Histogram::from_slice(&data, HistogramBins::Count(10))
        .style(&BoxStyle::new().fill("burlywood"));

    let v = ContinuousView::new().add(h);

    Page::single(&v).save("histogram.svg").expect("saving svg");
}