function_svg/
function_svg.rs1use plotlib::page::Page;
2use plotlib::repr::Plot;
3use plotlib::style::LineStyle;
4use plotlib::view::ContinuousView;
5
6fn main() {
7 let f1 =
8 Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
9 let f2 = Plot::from_function(|x| x.powi(2), 0., 10.)
10 .line_style(LineStyle::new().colour("darkolivegreen").width(2.));
11 let f3 = Plot::from_function(|x| x.sqrt() * 20., 0., 10.)
12 .line_style(LineStyle::new().colour("brown").width(1.));
13
14 let v = ContinuousView::new().add(f1).add(f2).add(f3);
15
16 Page::single(&v).save("function.svg").expect("saving svg");
17}