This example demonstrates VSL's plotting capabilities by creating an interactive scatter plot with both line and marker elements. Perfect for beginners learning data visualization with VSL.
- Basic VSL plot module usage
- Creating scatter plots with markers and lines
- Customizing plot appearance (colors, sizes, titles)
- Using the
vsl.utilmodule for data generation
- V compiler installed (download here)
- VSL library installed (installation guide)
- No additional system dependencies required
# Navigate to this directory
# Run the example
v run vsl/examples/plot_scatter/main.vThe example generates an interactive HTML plot that will open in your default browser, showing:
- A wavy pattern with red markers and connecting lines
- Customizable zoom and pan functionality
- Professional plot styling with title and responsive design
The example demonstrates several key concepts:
- Data Generation: Uses
util.arange()to create sequential x-values - Plot Configuration: Combines markers and lines in a single trace
- Styling: Shows how to set colors, sizes, and visual properties
- Display: Renders an interactive plot using VSL's Plotly backend
Try modifying the example to:
- Change colors and marker sizes
- Add multiple data series
- Experiment with different mathematical functions
- Add axis labels and annotations
plot_line_axis_titles- Adding axis labelsplot_scatter_with_annotations- Enhanced scatter plotsplot_scatter3d_1- Three-dimensional plotting
Plot doesn't open: Ensure you have a web browser installed and set as default
Module errors: Verify VSL installation with v list command
Build failures: Check V compiler version compatibility
Happy plotting! � Explore more VSL examples in the examples directory.