Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reference passed to non-reference #220

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions examples/data_analysis_example/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,23 @@ fn main() {

// Add traces for each class in the 3D plot
plt_3d.scatter3d(
x: x1_class0
y: x2_class0
z: [][]f64{len: x1_class0.len, init: [0.0]}
mode: 'markers'
x: x1_class0
y: x2_class0
z: [][]f64{len: x1_class0.len, init: [0.0]}
mode: 'markers'
marker: plot.Marker{
size: []f64{len: x1_class0.len, init: 8.0}
size: []f64{len: x1_class0.len, init: 8.0}
color: []string{len: x1_class0.len, init: 'blue'}
}
name: 'Class 0'
)
plt_3d.scatter3d(
x: x1_class1
y: x2_class1
z: [][]f64{len: x1_class1.len, init: [0.0]}
mode: 'markers'
x: x1_class1
y: x2_class1
z: [][]f64{len: x1_class1.len, init: [0.0]}
mode: 'markers'
marker: plot.Marker{
size: []f64{len: x1_class1.len, init: 8.0}
size: []f64{len: x1_class1.len, init: 8.0}
color: []string{len: x1_class1.len, init: 'red'}
}
name: 'Class 1'
Expand Down Expand Up @@ -134,14 +134,14 @@ fn main() {
mut plt_bars := plot.Plot.new()

plt_bars.bar(
x: []string{len: stat.mean_x.len, init: 'Class ${index}'}
y: stat.mean_x
x: []string{len: stat.mean_x.len, init: 'Class ${index}'}
y: stat.mean_x
name: 'Mean'
)

plt_bars.bar(
x: []string{len: stat.sig_x.len, init: 'Class ${index}'}
y: stat.sig_x
x: []string{len: stat.sig_x.len, init: 'Class ${index}'}
y: stat.sig_x
name: 'Standard Deviation'
)

Expand Down
12 changes: 6 additions & 6 deletions examples/fft_plot_example/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ fn main() {

// Add a scatter plot for the original signal
plt.scatter(
x: []f64{len: original_signal.len, init: f64(index)}
y: original_signal
mode: 'markers'
x: []f64{len: original_signal.len, init: f64(index)}
y: original_signal
mode: 'markers'
marker: plot.Marker{
size: []f64{len: original_signal.len, init: 8.0}
}
Expand All @@ -37,9 +37,9 @@ fn main() {

// Add a scatter plot for the imaginary part of the spectrum
plt.scatter(
x: []f64{len: spectrum.len, init: f64(index)}
y: spectrum
mode: 'markers'
x: []f64{len: spectrum.len, init: f64(index)}
y: spectrum
mode: 'markers'
marker: plot.Marker{
size: []f64{len: spectrum.len, init: 8.0}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/plot_annotated_pie_chart/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ fn main() {

mut plt := plot.Plot.new()
plt.pie(
labels: labels
values: values
labels: labels
values: values
textinfo: 'percent+label'
)
plt.layout(
Expand Down
4 changes: 2 additions & 2 deletions examples/plot_basic_heatmap/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fn main() {
z: z
)
plt.layout(
title: 'Heatmap Basic Implementation'
width: 750
title: 'Heatmap Basic Implementation'
width: 750
height: 750
)

Expand Down
8 changes: 4 additions & 4 deletions examples/plot_bubble_chart/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y
mode: 'markers'
x: x
y: y
mode: 'markers'
marker: plot.Marker{
size: size
size: size
color: []string{len: x.len * y.len, init: '#FF0000'}
}
name: 'Bubble Chart'
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_grouped_bar_chart/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ fn main() {

mut plt := plot.Plot.new()
plt.bar(
x: categories
y: values1
x: categories
y: values1
name: 'Group 1'
)
plt.bar(
x: categories
y: values2
x: categories
y: values2
name: 'Group 2'
)
plt.layout(
Expand Down
4 changes: 2 additions & 2 deletions examples/plot_heatmap_golden_ratio/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ fn main() {
z: z
)
plt.layout(
title: 'Heatmap with Unequal Block Sizes'
width: 750
title: 'Heatmap with Unequal Block Sizes'
width: 750
height: 750
)

Expand Down
10 changes: 5 additions & 5 deletions examples/plot_histogram/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ fn main() {

mut plt := plot.Plot.new()
plt.histogram(
x: x
x: x
xbins: plot.Bins{
start: 0.0
end: 100.0
size: 2
end: 100.0
size: 2
}
)
plt.layout(
title: 'Histogram Example'
width: 750
title: 'Histogram Example'
width: 750
height: 750
)
plt.show()!
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_line_axis_titles/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y1
x: x
y: y1
mode: 'lines'
line: plot.Line{
color: '#FF0000'
}
name: 'sin(x)'
)
plt.scatter(
x: x
y: y2
x: x
y: y2
mode: 'lines'
line: plot.Line{
color: '#0000FF'
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_line_plot_with_areas/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y1
x: x
y: y1
mode: 'lines'
line: plot.Line{
color: '#FF0000'
}
name: 'sin(x)'
)
plt.scatter(
x: x
y: y2
x: x
y: y2
mode: 'lines'
line: plot.Line{
color: '#0000FF'
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_pie/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ fn main() {
plt.pie(
labels: ['Nitrogen', 'Oxygen', 'Argon', 'Other']
values: [78.0, 21, 0.9, 0.1]
pull: [0.0, 0.1, 0, 0]
hole: 0.25
pull: [0.0, 0.1, 0, 0]
hole: 0.25
)
plt.layout(
title: 'Gases in the atmosphere'
width: 750
title: 'Gases in the atmosphere'
width: 750
height: 750
)
plt.show()!
Expand Down
6 changes: 3 additions & 3 deletions examples/plot_ripple_surface/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fn main() {

mut plt := plot.Plot.new()
plt.surface(
x: x
y: y
z: z
x: x
y: y
z: z
colorscale: 'Viridis'
)
plt.layout(
Expand Down
6 changes: 3 additions & 3 deletions examples/plot_saddle_surface/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ fn main() {

mut plt := plot.Plot.new()
plt.surface(
x: x
y: y
z: z
x: x
y: y
z: z
colorscale: 'Viridis'
)
plt.layout(
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_scatter/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y
mode: 'lines+markers'
x: x
y: y
mode: 'lines+markers'
marker: plot.Marker{
size: []f64{len: x.len, init: 10.0}
size: []f64{len: x.len, init: 10.0}
color: []string{len: x.len, init: '#FF0000'}
}
line: plot.Line{
Expand Down
10 changes: 5 additions & 5 deletions examples/plot_scatter3d_1/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter3d(
x: x
y: y
z: z
mode: 'lines+markers'
x: x
y: y
z: z
mode: 'lines+markers'
marker: plot.Marker{
size: []f64{len: x.len, init: 10.0}
size: []f64{len: x.len, init: 10.0}
color: []string{len: x.len, init: '#0000FF'}
}
line: plot.Line{
Expand Down
10 changes: 5 additions & 5 deletions examples/plot_scatter3d_2/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter3d(
x: x
y: y
z: z
mode: 'markers'
x: x
y: y
z: z
mode: 'markers'
marker: plot.Marker{
size: []f64{len: x.len, init: 15.0}
size: []f64{len: x.len, init: 15.0}
color: []string{len: x.len, init: '#0000FF'}
}
)
Expand Down
14 changes: 7 additions & 7 deletions examples/plot_scatter3d_easing/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ fn main() {
// Create the Scatter3D plot
mut plt := plot.Plot.new()
plt.scatter3d(
name: 'Easing Scatter3D'
x: x_values
y: y_values
z: [][]f64{len: z_values.len, init: z_values}
mode: 'markers'
name: 'Easing Scatter3D'
x: x_values
y: y_values
z: [][]f64{len: z_values.len, init: z_values}
mode: 'markers'
marker: plot.Marker{
size: []f64{len: x_values.len, init: 10.0}
color: time // Color based on time
size: []f64{len: x_values.len, init: 10.0}
color: time // Color based on time
colorscale: 'viridis'
}
)
Expand Down
8 changes: 4 additions & 4 deletions examples/plot_scatter_colorscale/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ fn main() {

mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y
mode: 'lines+markers'
x: x
y: y
mode: 'lines+markers'
colorscale: 'smoker'
marker: plot.Marker{
marker: plot.Marker{
size: []f64{len: x.len, init: 10.0}
}
)
Expand Down
14 changes: 7 additions & 7 deletions examples/plot_scatter_easing/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ fn main() {
// Create the Scatter plot
mut plt := plot.Plot.new()
plt.scatter(
name: 'Easing Scatter'
x: x_values
y: y_values
mode: 'markers'
name: 'Easing Scatter'
x: x_values
y: y_values
mode: 'markers'
colorscale: 'viridis'
marker: plot.Marker{
size: []f64{len: x_values.len, init: 10.0}
color: time // Color based on time
marker: plot.Marker{
size: []f64{len: x_values.len, init: 10.0}
color: time // Color based on time
colorscale: 'viridis'
}
)
Expand Down
10 changes: 5 additions & 5 deletions examples/plot_scatter_with_annotations/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ fn main() {
x := util.arange(y.len)
mut plt := plot.Plot.new()
plt.scatter(
x: x
y: y
mode: 'lines+markers'
x: x
y: y
mode: 'lines+markers'
marker: plot.Marker{
size: []f64{len: x.len, init: 10.0}
size: []f64{len: x.len, init: 10.0}
color: []string{len: x.len, init: '#FF0000'}
}
line: plot.Line{
color: '#FF0000'
}
)
plt.layout(
title: 'Scatter plot example'
title: 'Scatter plot example'
annotations: [plot.Annotation{
text: 'test annotation'
}]
Expand Down
Loading
Loading