From e49d857ae8d690cf01041b1df6f24a9a2dc92ed9 Mon Sep 17 00:00:00 2001 From: ulises-jeremias Date: Mon, 16 Oct 2023 23:16:11 -0300 Subject: [PATCH] Updated plot impl --- examples/vtl_plot_scatter_colorscale/main.v | 63 +++++++++++---------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/examples/vtl_plot_scatter_colorscale/main.v b/examples/vtl_plot_scatter_colorscale/main.v index c3724897..63da21dc 100644 --- a/examples/vtl_plot_scatter_colorscale/main.v +++ b/examples/vtl_plot_scatter_colorscale/main.v @@ -3,35 +3,36 @@ module main import vsl.plot import vtl -y := [ - 0.0, - 1, - 3, - 1, - 0, - -1, - -3, - -1, - 0, - 1, - 3, - 1, - 0, -] -x := vtl.seq[f64](y.len) +fn main() { + y := [ + 0.0, + 1, + 3, + 1, + 0, + -1, + -3, + -1, + 0, + 1, + 3, + 1, + 0, + ] + x := vtl.seq[f64](y.len) -mut plt := plot.new_plot() -plt.add_trace( - trace_type: .scatter - x: x.to_array() - y: y - mode: 'lines+markers' - colorscale: 'smoker' - marker: plot.Marker{ - size: []f64{len: x.size, init: 10.0} - } -) -plt.set_layout( - title: 'Scatter plot example' -) -plt.show()! + mut plt := plot.Plot.new() + plt.scatter( + x: x.to_array() + y: y + mode: 'lines+markers' + colorscale: 'smoker' + marker: plot.Marker{ + size: []f64{len: x.size, init: 10.0} + } + ) + plt.layout( + title: 'Scatter plot example' + ) + plt.show()! +}