Expand description
Scientific plotting library for bioinformatics, targeting SVG output with optional PNG and PDF backends.
§Pipeline
plot definition → Layout → Scene (primitives) → backend output- Build a plot struct using its builder API (e.g.
plot::scatter::ScatterPlot). - Collect plots into a
Vec<render::plots::Plot>— use.into()on any plot struct. - Build a
render::layout::Layoutwithrender::layout::Layout::auto_from_plotsand customise it. - Call
render_to_svg(orrender_to_png/render_to_pdf) to get the output in one step.
§Example
use kuva::prelude::*;
let scatter = ScatterPlot::new()
.with_data(vec![(1.0_f64, 2.0), (3.0, 4.0)])
.with_color("steelblue");
let plots: Vec<Plot> = vec![scatter.into()];
let svg = kuva::render_to_svg(plots, Layout::auto_from_plots(&[]));
assert!(svg.contains("<svg"));§Feature flags
| Feature | Description |
|---|---|
png | Enables PngBackend for rasterising SVG scenes via resvg. |
pdf | Enables PdfBackend for vector PDF output via svg2pdf. |
cli | Enables the kuva CLI binary (pulls in clap). |
full | Enables png + pdf. |
Re-exports§
pub use backend::terminal::TerminalBackend;pub use backend::png::PngBackend;pub use backend::raster::RasterBackend;pub use backend::pdf::PdfBackend;pub use render::theme::Theme;pub use render::palette::Palette;pub use render::layout::TickFormat;pub use render::render::render_twin_y;pub use render::render::render_sankey;pub use render::render::render_phylo_tree;pub use render::render::render_synteny;pub use render::datetime::DateTimeAxis;pub use render::datetime::DateUnit;pub use render::datetime::ymd;pub use render::datetime::ymd_hms;
Modules§
Functions§
- render_
to_ pdf - Render a collection of plots to a PDF byte vector in one call (requires feature
pdf). - render_
to_ png - Render a collection of plots to a PNG byte vector in one call (requires feature
png). - render_
to_ raster - Render a collection of plots directly to a PNG byte vector via
tiny_skia, bypassing SVG serialization and re-parsing (requires featurepng). - render_
to_ svg - Render a collection of plots to an SVG string in one call.