From 57ae1784be4fe5a142a8bd451b4fae9fe934cdc5 Mon Sep 17 00:00:00 2001 From: YuKun Liu Date: Mon, 9 Dec 2024 21:22:58 -0800 Subject: [PATCH] Fix: `histogram` data draw --- plotters/examples/histogram.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotters/examples/histogram.rs b/plotters/examples/histogram.rs index a56ce026..50cc360a 100644 --- a/plotters/examples/histogram.rs +++ b/plotters/examples/histogram.rs @@ -28,7 +28,7 @@ fn main() -> Result<(), Box> { chart.draw_series( Histogram::vertical(&chart) .style(RED.mix(0.5).filled()) - .data(data.iter().map(|x: &u32| (*x, 1))), + .data(data.iter().enumerate().map(|(x, &y)| (x, y))), )?; // To avoid the IO failure being ignored silently, we manually call the present function