Renders all bundles in a fiber::bundle_set as a single interactive 3D
line plot. Each bundle in the set (typically one per subject or session) can
be coloured uniformly by its bundle name or with the same per-streamline
colouring as plot3d() for fiber::bundle objects.
See plot3d() for the full parameter documentation.
Arguments
- x
A fiber::bundle_set 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
coloris 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.- color_by_bundle
Logical. When
TRUE, every streamline is coloured by its parent bundle name (one distinct colour per entry in the set), overriding thecolorargument. WhenFALSE(default),coloris applied as-is, inheriting the same per-streamline colouring behaviour as the fiber::bundle method.- ...
Additional named arguments forwarded to
plotly::layout(), e.g.title = "My bundle".
Value
An interactive plotly htmlwidget.
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))
bun_set <- bundle_set(list(bun, bun))
plot3d(bun_set)
#> ℹ Rendering 4 streamlines across 2 bundles...