pub struct SankeyPlot {Show 19 fields
pub nodes: Vec<SankeyNode>,
pub links: Vec<SankeyLink>,
pub alluvia: Vec<SankeyAlluvium>,
pub axis_names: Option<Vec<String>>,
pub link_color: SankeyLinkColor,
pub node_order: SankeyNodeOrder,
pub node_coloring: SankeyNodeColoring,
pub node_order_seed: u64,
pub palette: Option<Vec<String>>,
pub left_color_cutoff: f64,
pub link_opacity: f64,
pub node_width: f64,
pub node_gap: f64,
pub legend_label: Option<String>,
pub flow_labels: bool,
pub flow_percent: bool,
pub flow_label_format: TickFormat,
pub flow_label_unit: Option<String>,
pub flow_label_min_height: f64,
}Expand description
A Sankey diagram: nodes arranged in columns, connected by tapered ribbons.
Fields§
§nodes: Vec<SankeyNode>§links: Vec<SankeyLink>§alluvia: Vec<SankeyAlluvium>§axis_names: Option<Vec<String>>§link_color: SankeyLinkColor§node_order: SankeyNodeOrder§node_coloring: SankeyNodeColoring§node_order_seed: u64§palette: Option<Vec<String>>§left_color_cutoff: f64§link_opacity: f64Ribbon fill opacity (default 0.5).
node_width: f64Node rectangle width in pixels (default 20.0).
node_gap: f64Minimum gap between nodes in a column in pixels (default 8.0).
legend_label: Option<String>If set, adds one legend entry per node.
flow_labels: boolShow the absolute flow value on each ribbon (default false).
flow_percent: boolShow each flow as a percentage of its source node’s total outflow (default false).
Takes priority over flow_labels when both are set.
flow_label_format: TickFormatNumber format for absolute flow labels (default Auto).
flow_label_unit: Option<String>Optional unit suffix appended to absolute labels, e.g. "reads" → "1 200 reads".
flow_label_min_height: f64Minimum ribbon height in pixels required to render a label.
Set to 0.0 to always show labels regardless of ribbon size (default 8.0).
Implementations§
Source§impl SankeyPlot
impl SankeyPlot
pub fn new() -> Self
Sourcepub fn with_node<S: Into<String>>(self, label: S) -> Self
pub fn with_node<S: Into<String>>(self, label: S) -> Self
Declare a node explicitly (no-op if it already exists).
Sourcepub fn with_node_color<S: Into<String>, C: Into<String>>(
self,
label: S,
color: C,
) -> Self
pub fn with_node_color<S: Into<String>, C: Into<String>>( self, label: S, color: C, ) -> Self
Set the color for a node, creating it if absent.
Sourcepub fn with_node_column<S: Into<String>>(self, label: S, col: usize) -> Self
pub fn with_node_column<S: Into<String>>(self, label: S, col: usize) -> Self
Pin a node to a specific column, creating it if absent.
Sourcepub fn with_link<S: Into<String>>(
self,
source: S,
target: S,
value: impl Into<f64>,
) -> Self
pub fn with_link<S: Into<String>>( self, source: S, target: S, value: impl Into<f64>, ) -> Self
Add a link, auto-creating nodes by label if needed.
Sourcepub fn with_link_colored<S: Into<String>, C: Into<String>>(
self,
source: S,
target: S,
value: impl Into<f64>,
color: C,
) -> Self
pub fn with_link_colored<S: Into<String>, C: Into<String>>( self, source: S, target: S, value: impl Into<f64>, color: C, ) -> Self
Add a link with an explicit per-link color.
Sourcepub fn with_links<S, V, I>(self, links: I) -> Self
pub fn with_links<S, V, I>(self, links: I) -> Self
Bulk add links from an iterator of (source_label, target_label, value).
Sourcepub fn with_axis_names<S, I>(self, axis_names: I) -> Self
pub fn with_axis_names<S, I>(self, axis_names: I) -> Self
Set display/canonical names for alluvium axes in input order.
Sourcepub fn with_alluvium<S, I>(self, strata: I, value: impl Into<f64>) -> Self
pub fn with_alluvium<S, I>(self, strata: I, value: impl Into<f64>) -> Self
Add a weighted alluvium spanning multiple ordered axes.
Sourcepub fn with_alluvia<S, I, J>(self, alluvia: J) -> Self
pub fn with_alluvia<S, I, J>(self, alluvia: J) -> Self
Bulk add weighted alluvia from an iterator of (strata, value).
Sourcepub fn with_gradient_links(self) -> Self
pub fn with_gradient_links(self) -> Self
Use gradient ribbons (linearGradient from source to target color).
Sourcepub fn with_per_link_colors(self) -> Self
pub fn with_per_link_colors(self) -> Self
Use per-link colors (falls back to source color if link.color is None).
Sourcepub fn with_node_order(self, order: SankeyNodeOrder) -> Self
pub fn with_node_order(self, order: SankeyNodeOrder) -> Self
Choose how nodes are ordered within each column.
Sourcepub fn with_node_coloring(self, coloring: SankeyNodeColoring) -> Self
pub fn with_node_coloring(self, coloring: SankeyNodeColoring) -> Self
Choose how node colors are assigned when explicit node colors are absent.
Sourcepub fn with_node_order_seed(self, seed: u64) -> Self
pub fn with_node_order_seed(self, seed: u64) -> Self
Set the RNG seed used by crossing-reduction ordering.
Sourcepub fn with_crossing_reduction(self) -> Self
pub fn with_crossing_reduction(self) -> Self
Minimize weighted crossings within columns using a wompwomp-style TSP cycle with Fenwick-scored objective evaluation.
Sourcepub fn with_neighbornet(self) -> Self
pub fn with_neighbornet(self) -> Self
Use the neighbornet backend for alluvium/Sankey ordering.
Sourcepub fn with_left_coloring(self) -> Self
pub fn with_left_coloring(self) -> Self
Match wompwomp’s left-to-right color propagation.
Sourcepub fn with_palette(self, colors: Vec<String>) -> Self
pub fn with_palette(self, colors: Vec<String>) -> Self
Override the palette used for fallback Sankey node colors.
Sourcepub fn with_left_color_cutoff(self, cutoff: f64) -> Self
pub fn with_left_color_cutoff(self, cutoff: f64) -> Self
Set the parent-share threshold used by left coloring. Default: 0.5.
pub fn with_link_opacity(self, opacity: f64) -> Self
pub fn with_node_width(self, width: f64) -> Self
pub fn with_node_gap(self, gap: f64) -> Self
pub fn with_legend<S: Into<String>>(self, label: S) -> Self
Sourcepub fn with_flow_labels(self) -> Self
pub fn with_flow_labels(self) -> Self
Show the absolute flow value on each ribbon.
Combine with with_flow_label_format and
with_flow_label_unit as needed.
Sourcepub fn with_flow_percent(self) -> Self
pub fn with_flow_percent(self) -> Self
Show each flow as a percentage of its source node’s total outflow.
Takes priority over with_flow_labels when both are set.
Sourcepub fn with_flow_label_format(self, fmt: TickFormat) -> Self
pub fn with_flow_label_format(self, fmt: TickFormat) -> Self
Number format for absolute flow labels (default: TickFormat::Auto).
Has no effect when with_flow_percent is active.
Sourcepub fn with_flow_label_unit<S: Into<String>>(self, unit: S) -> Self
pub fn with_flow_label_unit<S: Into<String>>(self, unit: S) -> Self
Append a unit string to each absolute flow label, e.g. "reads" → "1200 reads".
Has no effect in percent mode.
Sourcepub fn with_flow_label_min_height(self, min_h: f64) -> Self
pub fn with_flow_label_min_height(self, min_h: f64) -> Self
Minimum ribbon height in pixels required to render a flow label.
Set to 0.0 to always show labels regardless of ribbon size (default: 8.0).
Trait Implementations§
Source§impl Clone for SankeyPlot
impl Clone for SankeyPlot
Source§fn clone(&self) -> SankeyPlot
fn clone(&self) -> SankeyPlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SankeyPlot
impl Debug for SankeyPlot
Source§impl Default for SankeyPlot
impl Default for SankeyPlot
Source§impl From<SankeyPlot> for Plot
impl From<SankeyPlot> for Plot
Source§fn from(p: SankeyPlot) -> Self
fn from(p: SankeyPlot) -> Self
Auto Trait Implementations§
impl Freeze for SankeyPlot
impl !RefUnwindSafe for SankeyPlot
impl Send for SankeyPlot
impl Sync for SankeyPlot
impl Unpin for SankeyPlot
impl UnsafeUnpin for SankeyPlot
impl !UnwindSafe for SankeyPlot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.