aboutsummaryrefslogtreecommitdiff
path: root/examples/normal-dist.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/normal-dist.rs')
-rw-r--r--examples/normal-dist.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/normal-dist.rs b/examples/normal-dist.rs
index 65cf0e3..20d048a 100644
--- a/examples/normal-dist.rs
+++ b/examples/normal-dist.rs
@@ -25,14 +25,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut x_hist_ctx = ChartBuilder::on(&areas[0])
.y_label_area_size(40)
- .build_ranged(0u32..100u32, 0f64..0.5f64)?;
+ .build_cartesian_2d((0.0..1.0).step(0.01).use_round().into_segmented(), 0..250)?;
let mut y_hist_ctx = ChartBuilder::on(&areas[3])
.x_label_area_size(40)
- .build_ranged(0f64..0.5f64, 0..100u32)?;
+ .build_cartesian_2d(0..250, (0.0..1.0).step(0.01).use_round())?;
let mut scatter_ctx = ChartBuilder::on(&areas[2])
.x_label_area_size(40)
.y_label_area_size(40)
- .build_ranged(0f64..1f64, 0f64..1f64)?;
+ .build_cartesian_2d(0f64..1f64, 0f64..1f64)?;
scatter_ctx
.configure_mesh()
.disable_x_mesh()
@@ -46,21 +46,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let x_hist = Histogram::vertical(&x_hist_ctx)
.style(GREEN.filled())
.margin(0)
- .data(
- random_points
- .iter()
- .map(|(x, _)| ((x * 100.0) as u32, 0.002)),
- );
+ .data(random_points.iter().map(|(x, _)| (*x, 1)));
let y_hist = Histogram::horizontal(&y_hist_ctx)
.style(GREEN.filled())
.margin(0)
- .data(
- random_points
- .iter()
- .map(|(_, y)| ((y * 100.0) as u32, 0.002)),
- );
+ .data(random_points.iter().map(|(_, y)| (*y, 1)));
x_hist_ctx.draw_series(x_hist)?;
y_hist_ctx.draw_series(y_hist)?;
Ok(())
}
+#[test]
+fn entry_point() {
+ main().unwrap()
+}