Skip to content

Commit

Permalink
Updated plot impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Oct 17, 2023
1 parent 8dc078b commit e49d857
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions examples/vtl_plot_scatter_colorscale/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -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()!
}

0 comments on commit e49d857

Please sign in to comment.