graplot
'graplot' is an experimental plotting library written in Rust that is based on macroquad (internally litequad). It creates a window displaying the graphs.
Installation
Add 'graplot' as a dependency:
[]
= "0.1.9"
Examples
use Plot;
let plot = new;
plot.show;
Multiple graphs:
use Plot;
let xs = ;
let ys = ;
let ys1 = ;
let ys2 = ;
let mut plot = new;
plot.add;
plot.add;
plot.show;
Label the x and y axis and set a title:
use ;
let mut plot = new;
plot.set_title;
plot.set_xlabel;
plot.set_ylabel;
plot.show;
Sine wave:
use Plot;
let mut xs = ;
let mut add = 0f64;
for idx in 0..1000
let mut ys = ;
for in ys.iter_mut.enumerate
// or alternatively: let plot = Plot::new((|x: f64| x.sin(), x(4.)));
let plot = new;
plot.show;
x³ + x² - 0.08:
use ;
// x(...) ... sets the absolute max value for x
let plot = new;
plot.show;
x² - 0.5:
use Plot;
let plot = new;
plot.show;
Using a line description: (matplotlib)
use Plot;
// c ... cyan color, - ... solid line, o ... ring marker
let plot = new;
plot.show;
Custom scaling:
use ;
let mut plot = new;
plot.set_desc;
plot.show;
Another version for miniquad is needed for this feature. Therefore is it broken. Spawning multiple windows on linux:
let mut plot = new;
plot.set_title;
let h = plot.show_threaded // show_threaded() is currently linux only;
let mut plot = new;
plot.set_title;
plot.show;
h.join.unwrap // you need to close both windows
Changelog
- 0.1.9: fixed bug
- 0.1.8: set color now uses 3 args, fixed step size
- 0.1.7: Set graph color, custom x & y "line" spacing and step size | "custom scaling"
- 0.1.6: Label x axis, litequad
- 0.1.5: y axis, set title, /mutliple windows on linux/ | yanked
- 0.1.4: Multiple graphs