1个不稳定版本
| 0.1.0 | 2021年7月24日 |
|---|
#268 in 可视化
35KB
1K SLoC
splot
在Rust中绘制数据
lib.rs:
splot
使用SVG绘制数据
一个Chart可以通过使用Display特质转换成SVG文档。也就是说,使用println!,或者甚至使用to_string就足够了。
示例线形图
use splot::{Chart, Domain, plot};
let data = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let domain = Domain::from_data(&data).with_x(&[0.0, 200.0]);
let plot = plot::Line::new(&domain, &data);
let chart = Chart::builder()
.with_title("Line Plot")
.with_axis(domain.x_axis().with_name("X Axis Name"))
.with_axis(domain.y_axis().with_name("Y Axis Name").on_right())
.with_plot(&plot)
.build();
println!("{}", chart);