pub enum Arrangement {
Snap,
Perpendicular,
Freeform,
Fixed,
}Expand description
An enumeration representing node arrangement strategies for Sankey diagrams.
The Arrangement enum controls how nodes are positioned relative to each other:
Snap— If value issnap(the default), the node arrangement is assisted by automatic snapping of elements to preserve space between nodes specified vianodepad.Perpendicular— Nodes can only move along a line perpendicular to the primary flow.Freeform— Nodes can freely move anywhere on the plane without automatic constraints.Fixed— Nodes remain stationary at their specified positions and are not adjusted by the layout algorithm.
§Example
use plotlars::{Arrangement, SankeyDiagram, Orientation, Plot, Rgb, Text};
use polars::prelude::*;
let dataset = df![
"source" => &["A1", "A2", "A1", "B1", "B2", "B2"],
"target" => &["B1", "B2", "B2", "C1", "C1", "C2"],
"value" => &[8, 4, 2, 8, 4, 2],
].unwrap();
SankeyDiagram::builder()
.data(&dataset)
.sources("source")
.targets("target")
.values("value")
.orientation(Orientation::Horizontal)
.arrangement(Arrangement::Freeform)
.node_colors(vec![
Rgb(222, 235, 247),
Rgb(198, 219, 239),
Rgb(158, 202, 225),
Rgb(107, 174, 214),
Rgb( 66, 146, 198),
Rgb( 33, 113, 181),
])
.link_colors(vec![
Rgb(222, 235, 247),
Rgb(198, 219, 239),
Rgb(158, 202, 225),
Rgb(107, 174, 214),
Rgb( 66, 146, 198),
Rgb( 33, 113, 181),
])
.build()
.plot();
Variants§
Trait Implementations§
Source§impl Clone for Arrangement
impl Clone for Arrangement
Source§fn clone(&self) -> Arrangement
fn clone(&self) -> Arrangement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Arrangement
impl RefUnwindSafe for Arrangement
impl Send for Arrangement
impl Sync for Arrangement
impl Unpin for Arrangement
impl UnwindSafe for Arrangement
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more