# kuva
**kuva** is a scientific plotting library for Rust that renders plots to SVG. It targets bioinformatics use cases and ships with 25 specialised plot types — from standard scatter and bar charts to Manhattan plots, UpSet plots, phylogenetic trees, and synteny diagrams. A `kuva` CLI binary lets you render plots directly from the shell without writing any Rust.
## Design
The API follows a builder pattern. Every plot type is constructed with `::new()`, configured with method chaining, and rendered through a single pipeline:
```
plot struct → Plot enum → Layout → Scene → SVG string
```
## Quick start
```rust,no_run
use kuva::plot::scatter::ScatterPlot;
use kuva::backend::svg::SvgBackend;
use kuva::render::render::render_multiple;
use kuva::render::layout::Layout;
use kuva::render::plots::Plot;
let data = vec![(1.0_f64, 2.0_f64), (3.0, 5.0), (5.0, 4.0)];
let plot = ScatterPlot::new()
.with_data(data)
.with_color("steelblue")
.with_size(5.0);
let plots = vec![Plot::Scatter(plot)];
let layout = Layout::auto_from_plots(&plots)
.with_title("My Plot")
.with_x_label("X")
.with_y_label("Y");
let scene = render_multiple(plots, layout);
let svg = SvgBackend.render_scene(&scene);
std::fs::write("my_plot.svg", svg).unwrap();
```
## Regenerating documentation assets
The SVG images embedded in these docs are generated by standalone example programs in the `examples/` directory. Regenerate all assets at once with:
```bash
bash scripts/gen_docs.sh
```
Or regenerate a single plot type:
```bash
cargo run --example scatter
cargo run --example histogram
# etc. — one example per plot type in examples/
```
## Building the book
Install [mdBook](https://rust-lang.github.io/mdBook/), then:
```bash
mdbook build docs # produce docs/book/
mdbook serve docs # live-reload preview at http://localhost:3000
```