scatter_svg/
scatter_svg.rs1use plotlib::page::Page;
2use plotlib::repr::Plot;
3use plotlib::style::{PointMarker, PointStyle};
4use plotlib::view::ContinuousView;
5
6fn main() {
7 let data1 = vec![
9 (-3.0, 2.3),
10 (-1.6, 5.3),
11 (0.3, 0.7),
12 (4.3, -1.4),
13 (6.4, 4.3),
14 (8.5, 3.7),
15 ];
16
17 let s1: Plot = Plot::new(data1).point_style(
19 PointStyle::new()
20 .marker(PointMarker::Square) .colour("#DD3355"),
22 ); let data2 = vec![(-1.4, 2.5), (7.2, -0.3)];
26 let s2: Plot = Plot::new(data2).point_style(
27 PointStyle::new() .colour("#35C788"),
29 ); let v = ContinuousView::new()
33 .add(s1)
34 .add(s2)
35 .x_range(-5., 10.)
36 .y_range(-2., 6.)
37 .x_label("Some varying variable")
38 .y_label("The response of something");
39
40 Page::single(&v).save("scatter.svg").unwrap();
42}