Installation Methods
Kuva can be installed as a Rust library (for use in your code) or as a standalone CLI binary (for command-line plotting). Both methods support optional PNG and PDF backends.Library Installation
Add Kuva to Cargo.toml
Add the dependency to your
Cargo.toml file:The default installation includes only SVG output. Enable optional features for PNG (via
resvg) or PDF (via svg2pdf) support.Import the prelude
Import all commonly used types with a single line:This brings into scope:
- All 25 plot structs (
ScatterPlot,LinePlot,VolcanoPlot, etc.) - The
Plotenum LayoutandFigurefor compositionThemeandPalettefor styling- Render functions (
render_to_svg,render_to_png,render_to_pdf) - Backend types (
SvgBackend,PngBackend,PdfBackend,TerminalBackend)
CLI Installation
The CLI binary provides command-line access to all plot types without writing Rust code.Install from crates.io
kuva binary to ~/.cargo/bin/ (ensure it’s in your PATH).Installation may take several minutes as dependencies are compiled. The
full feature requires additional system libraries for PDF/PNG rendering.Install from source
Clone the repository and build locally:The binary will be at
target/release/kuva. Copy it to a location in your PATH.Feature Flags Reference
Kuva uses Cargo feature flags to control optional functionality:| Feature | Description | Dependencies |
|---|---|---|
| (default) | SVG output only | None (uses built-in SVG renderer) |
png | Enable PNG rasterization via resvg | resvg = "0.44" |
pdf | Enable PDF vector output via svg2pdf | svg2pdf = "0.13" |
cli | Build the kuva CLI binary | clap = "4", clap_mangen = "0.2" |
full | Enable both PNG and PDF (png + pdf) | All of the above |
System Requirements
Minimum Rust Version
Kuva requires Rust 2021 edition or later. The MSRV (Minimum Supported Rust Version) is currently 1.70.0.Platform Support
Kuva is tested on:- Linux — Ubuntu 20.04+, Debian 11+, Fedora 35+
- macOS — macOS 11+ (Intel and Apple Silicon)
- Windows — Windows 10+ (x86_64)
Optional Dependencies
If using thepng feature, ensure you have:
- Standard C/C++ compiler toolchain
- System libraries that
resvgdepends on (typically already present)
pdf feature:
- No additional system dependencies required
Troubleshooting
Installation fails with linker errors
Installation fails with linker errors
This typically happens with the On Fedora/RHEL:On macOS:
png feature on systems missing development libraries.On Ubuntu/Debian:CLI binary not found after installation
CLI binary not found after installation
Ensure Or for zsh:
~/.cargo/bin is in your PATH:Compilation is very slow
Compilation is very slow
Enable parallel compilation and increase optimization:
Version conflicts with other crates
Version conflicts with other crates
If you see dependency resolution errors, try:Or pin specific dependency versions in your
Cargo.toml.Next Steps
Quick Start
Create your first plot in minutes
API Reference
Explore the full API documentation