CLI program written in Rust that parses a mathematical function of x and renders its graph to an image file.
- reads function from CLI argument
- samples function over a numeric range
- renders 2D plot to image (e.g. PNG)
- no GUI, no server, just a binary
- Rust (stable)
- cargo
git clone https://github.com/TygrysGracz/rust-function-plotter
cd rust-function-plotter
cargo build --releaseRun
cargo run --release -- "sin(x)" output.png
- variable:
x - operators:
+ - * / ^ - parentheses supported
- typical math functions:
sin,cos,tan,log,exp(depends on parser implementation)
- default X range is hardcoded (check
main.rs) - step size controls smoothness and performance
- edit constants in code to change resolution or bounds
- image is written to the path given as the second argument
- existing file will be overwritten