stochastic-rs

Visualization

GridPlotter — Plotly-based grid plotter for quick HTML visualisation of paths, surfaces, and smiles. Feature-gated behind viz.

Visualization

stochastic-rs-viz ships GridPlotter — a thin wrapper over Plotly that produces self-contained HTML plots suitable for notebooks, READMEs, and quick visual checks.

The crate is feature-gated behind viz (default off) so a default build does not pull Plotly's transitive deps.

[dependencies]
stochastic-rs-viz = "2.0.0"
# or via the umbrella:
stochastic-rs = { version = "2.0.0", features = ["viz"] }

Examples

Sample-path overlay

use stochastic_rs::viz::GridPlotter;
use stochastic_rs::stochastic::diffusion::ou::Ou;
use stochastic_rs::traits::ProcessExt;

let p = Ou::<f64>::new(2.0, 0.0, 1.0, 1_000, Some(0.0), Some(1.0));
let paths = p.sample_par(8);

let mut plot = GridPlotter::new();
plot.add_paths("OU", &paths);
plot.write_html("ou_paths.html")?;

Implied-vol surface heatmap

use stochastic_rs::viz::GridPlotter;
use stochastic_rs::quant::vol_surface::implied::ImpliedVolSurface;

let surface = ImpliedVolSurface::<f64>::from_market(
    &strikes, &expiries, &iv_grid, /* spot */ 100.0,
);

let mut plot = GridPlotter::new();
plot.add_iv_surface("IV", &surface);
plot.write_html("iv_surface.html")?;

What you get

  • Sample-path overlays (single + many paths)
  • Distribution histograms with overlaid pdf
  • 2-D heatmaps (vol surface, IV grid)
  • 3-D surface plots
  • Smile / skew comparison panels

For interactive notebooks, prefer the Python bindings — the same data can be passed straight to matplotlib, plotly.py, or bokeh.

On this page