sb_rust_library/plotter/
mod.rs

1//! Tiny library used to plot data through graphical primitives.
2//!
3//! The main object it provides is [`Plot`](struct.Plot.html) which enables
4//! plotting data using basic primitives like circles, line segments, and
5//! oriented points. You can plot data using any of the shapes provided in
6//! [`shapes`](plotter.shapes) through the corresponding draw methods.
7//! # Examples
8//!
9//! Basic sine wave without axis labels
10//!
11//! ```
12//! let mut p = Plot::new(300, 200)
13//!   .with_canvas_color(GREY)
14//!   .with_bg_color(BLUE)
15//!   .with_plotting_range(0.0..(2.0 * PI), -1.1..1.1)
16//!   .with_drawing_bounds(0.05..0.95, 0.1..0.95);
17//!
18//! let x_values: Vec<f64> = (0..1000).map(|i| (i as f64) / 1000.0 * 2.0 * PI).collect();
19//! let points: Vec<Point> = x_values.into_iter().map(|x| {
20//!   (x, x.sin()).into()
21//! }).collect();
22//!
23//! let circle = Circle::new(RED, 1);
24//! p.draw_circles(&circle, &points);
25//! p.save("sine-wave.bmp").unwrap();
26//! ```
27
28mod color;
29mod plot_frame;
30mod plot;
31mod shapes;
32
33pub use color::*;
34pub use plot::Plot;
35pub use shapes::{Circle, Orientation};