Skip to contents

Renders all streamlines in a fiber::bundle as a single interactive 3D line plot. See plot3d() for the full parameter documentation and examples.

Arguments

x

A fiber::bundle object.

color

Controls how streamline colours are assigned. Accepted values:

  • "orientation" (default): per-point RGB colour derived from the local fibre direction. The absolute values of the normalised tangent vector \((|dx|, |dy|, |dz|)\) are mapped to the R, G, B channels — the standard DTI colour convention (left-right = red, anterior-posterior = green, superior-inferior = blue).

  • A metadata key: a string matching a key in @point_data (per-point scalar) or @streamline_data (per-streamline scalar, broadcast to all points). Numeric values are mapped to a continuous colour scale (palette); character values are coloured categorically.

  • A CSS/hex colour string: e.g. "#E69F00" or "steelblue". All lines are drawn in that fixed colour.

palette

A plotly / ColorBrewer colour scale name applied when color is a numeric metadata key. Defaults to "Viridis".

linewidth

Numeric. Width of the plotted lines. Defaults to 2.

opacity

Numeric in [0, 1]. Global line opacity. Defaults to 0.5.

...

Additional named arguments forwarded to plotly::layout(), e.g. title = "My bundle".

Value

An interactive plotly htmlwidget.

See also

Examples

library(fiber)

# --- minimal streamline example -------------------------------------------
pts <- matrix(
  c(0, 0, 0,
    1, 1, 0,
    2, 1, 1,
    3, 2, 1),
  ncol = 3, byrow = TRUE,
  dimnames = list(NULL, c("X", "Y", "Z"))
)
sl <- streamline(
  points          = pts,
  point_data      = list(FA = c(0.3, 0.5, 0.7, 0.6)),
  streamline_data = list(mean_FA = 0.525)
)

bun <- bundle(list(sl, sl))
plot3d(bun)
#>  Rendering 2 streamlines...
plot3d(bun, color = "mean_FA", palette = "RdYlBu") #> Rendering 2 streamlines...