1use pointy::BBox;
2use splotch::{
3 axis::{Horizontal, Vertical},
4 plot, Chart, Page,
5};
6
7fn main() {
8 let data_a =
9 vec![(13.0, 74.0), (111.0, 37.0), (125.0, 52.0), (190.0, 66.0)];
10 let data_b =
11 vec![(22.0, 50.0), (105.0, 44.0), (120.0, 67.0), (180.0, 39.0)];
12 let domain = BBox::new(data_a.iter().cloned());
13 let plot_a = plot::Scatter::new("Series A", &domain, &data_a);
14 let plot_b = plot::Scatter::new("Series B", &domain, &data_b);
15 let page = Page::default().with_chart(
16 Chart::default()
17 .with_title("Scatter Plot")
18 .with_axis(Horizontal::new(domain).with_name("X Axis Name"))
19 .with_axis(Vertical::new(domain).with_name("Y Axis Name"))
20 .with_axis(Vertical::new(domain).on_right())
21 .with_plot(&plot_a)
22 .with_plot(&plot_b),
23 );
24 print!("{}", page);
25}