From 5daee0b9b6b5cbec0ff2cef6bd6f840e3833c0ad Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Tue, 10 Dec 2024 17:37:20 -0700 Subject: [PATCH 1/2] Make i, j, k optional --- plotly/src/traces/mesh3d.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plotly/src/traces/mesh3d.rs b/plotly/src/traces/mesh3d.rs index fc45d781..223c4a45 100644 --- a/plotly/src/traces/mesh3d.rs +++ b/plotly/src/traces/mesh3d.rs @@ -389,17 +389,17 @@ where x: Vec, y: Vec, z: Vec, - i: Vec, - j: Vec, - k: Vec, + i: Option>, + j: Option>, + k: Option>, ) -> Box { Box::new(Self { x: Some(x), y: Some(y), z: Some(z), - i: Some(i), - j: Some(j), - k: Some(k), + i, + j, + k, ..Default::default() }) } @@ -484,9 +484,9 @@ mod tests { vec![0.0, 1.0, 2.0], vec![3.0, 4.0, 5.0], vec![6.0, 7.0, 8.0], - vec![0], - vec![1], - vec![2], + Some(vec![0]), + Some(vec![1]), + Some(vec![2]), ) .name("trace_name") .visible(Visible::True) From 233b94f0f85775edb7ef1f29538a6dd7ff83b84f Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Thu, 12 Dec 2024 01:03:21 -0700 Subject: [PATCH 2/2] Update example to work with optional i,j,k --- examples/3d_charts/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/3d_charts/src/main.rs b/examples/3d_charts/src/main.rs index 274ab493..f4b7c03a 100644 --- a/examples/3d_charts/src/main.rs +++ b/examples/3d_charts/src/main.rs @@ -172,9 +172,9 @@ fn mesh_3d_plot(show: bool) -> Plot { vec![0, 1, 2, 0], vec![0, 0, 1, 2], vec![0, 2, 0, 1], - vec![0, 0, 0, 1], - vec![1, 2, 3, 2], - vec![2, 3, 1, 3], + Some(vec![0, 0, 0, 1]), + Some(vec![1, 2, 3, 2]), + Some(vec![2, 3, 1, 3]), ) .intensity(vec![0.0, 0.33, 0.66, 1.0]) .color_scale(ColorScale::Palette(ColorScalePalette::Rainbow));