scatter_text/
scatter_text.rs1use plotlib::page::Page;
2use plotlib::repr::Plot;
3use plotlib::style::{PointMarker, PointStyle};
4use plotlib::view::ContinuousView;
5
6fn main() {
7 let data = vec![
8 (-3.0, 2.3),
9 (-1.6, 5.3),
10 (0.3, 0.7),
11 (4.3, -1.4),
12 (6.4, 4.3),
13 (8.5, 3.7),
14 ];
15 let s1 = Plot::new(data).point_style(PointStyle::new().marker(PointMarker::Circle));
16 let s2 = Plot::new(vec![(-1.4, 2.5), (7.2, -0.3)])
17 .point_style(PointStyle::new().marker(PointMarker::Square));
18
19 let v = ContinuousView::new()
20 .add(s1)
21 .add(s2)
22 .x_range(-5., 10.)
23 .y_range(-2., 6.)
24 .x_label("Some varying variable")
25 .y_label("The response of something");
26
27 println!("{}", Page::single(&v).dimensions(80, 30).to_text().unwrap());
28}