use plt::*;
fn main() {
let xs: Vec<f64> = (0..=100).map(|n: u32| n as f64 / 100.0).collect();
let y1s: Vec<f64> = xs.iter().map(|x| x.powi(3)).collect();
let y2s: Vec<f64> = y1s.iter().map(|y| *y * 20.0).rev().collect();
let mut sp = Subplot::builder()
.title("double plot")
.label(Axes::X, "x data")
.label(Axes::Y, "y1 data")
.label(Axes::SecondaryY, "y2 data")
.build();
sp.plot(&xs, &y1s).unwrap();
sp.plotter()
.use_secondary_yaxis()
.plot(&xs, &y2s)
.unwrap();
let mut fig = <Figure>::default();
fig.set_layout(SingleLayout::new(sp)).unwrap();
fig.draw_file(FileFormat::Png, "example.png").unwrap();
}