#r "nuget: Plotly.NET, 3.0.0"
#r "nuget: Plotly.NET.Interactive, 3.0.0"
Summary: This example shows how to create parallel categories plot in F#.
The parallel categories diagram (also known as parallel sets or alluvial diagram) is a visualization of multi-dimensional categorical data sets. Each variable in the data set is represented by a column of rectangles, where each rectangle corresponds to a discrete value taken on by that variable. The relative heights of the rectangles reflect the relative frequency of occurrence of the corresponding value.
Combinations of category rectangles across dimensions are connected by ribbons, where the height of the ribbon corresponds to the relative frequency of occurrence of the combination of categories in the data set.
open Plotly.NET
open Plotly.NET.TraceObjects
let dims =
[
Dimension.initParallel(Values = ["Cat1";"Cat1";"Cat1";"Cat1";"Cat2";"Cat2";"Cat3"],Label="A")
Dimension.initParallel(Values = [0;1;0;1;0;0;0],Label="B",TickText=["YES";"NO"])
]
let parcats =
Chart.ParallelCategories(
dims,
LineColor = Color.fromColorScaleValues [0.;1.;0.;1.;0.;0.;0.],
LineColorScale = StyleParam.Colorscale.Blackbody
)
parcats
This example shows the usage of some of the styling possibility using Chart.ParallelCategories
.
For even more styling control, use the respective TraceStyle function TraceDomainStyle.ParallelCategories
let parcatsStyled =
let dims =
[
Dimension.initParallel(Values = ["A";"A";"A";"B";"B";"B";"C";"D"],Label="Lvl1")
Dimension.initParallel(Values = ["AA";"AA";"AB";"AB";"AB";"AB";"AB";"AB"],Label="Lvl2")
Dimension.initParallel(Values = ["AAA";"AAB";"AAC";"AAC";"AAB";"AAB";"AAA";"AAA"],Label="Lvl3")
]
Chart.ParallelCategories(
dims,
LineColor = Color.fromColorScaleValues [0; 1; 2; 2; 1; 1; 0; 0], // These values map to the last category axis, meaning [AAA => 0; AAB = 1; AAC => 2]
LineColorScale = StyleParam.Colorscale.Viridis,
BundleColors = false
)
parcatsStyled