Data Lifetime
for _ in 0..1000 {
plot.scatter(random_million_points());
}
// plot has 1_000*1_000_000 points in memory
// layout and axis limits are determined from 1_000*1_000_000 points
plot.draw_to_file("large.png", (500, 500)).unwrap();// Plotters example
use plotters::prelude::*;
let mut cc = ChartBuilder::on(&upper)
.margin(5)
.set_all_label_area_size(50) // you should manually calculate this
.caption("Sine and Cosine", ("sans-serif", 40))
.build_cartesian_2d(-3.4f32..3.4, -1.2f32..1.2f32)?;
cc.configure_mesh()
.x_labels(20) // you should manually calculate this
.y_labels(10) // you should manually calculate this
.disable_mesh()
.x_label_formatter(&|v| format!("{:.1}", v))
.y_label_formatter(&|v| format!("{:.1}", v))
.draw()?;Last updated