1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/// An enumeration representing node arrangement strategies for Sankey diagrams.
///
/// The `Arrangement` enum controls how nodes are positioned relative to each other:
///
/// * `Snap` — If value is `snap` (the default), the node arrangement is assisted by
/// automatic snapping of elements to preserve space between nodes specified via `nodepad`.
/// * `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
///
/// ```rust
/// 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();
/// ```
///
/// 