Parallel coordinates

BinderScriptNotebook

Summary: This example shows how to create parallel coordinates plot in F#.

let's first create some data for the purpose of creating example charts:

open Plotly.NET 

let data = 
    [
        "A",[1.;4.;3.4;0.7;]
        "B",[3.;1.5;1.7;2.3;]
        "C",[2.;4.;3.1;5.]
        "D",[4.;2.;2.;4.;]
    ]

Parallel coordinates are a common way of visualizing high-dimensional geometry and analyzing multivariate data. To show a set of points in an n-dimensional space, a backdrop is drawn consisting of n parallel lines, typically vertical and equally spaced. A point in n-dimensional space is represented as a polyline with vertices on the parallel axes; the position of the vertex on the i-th axis corresponds to the i-th coordinate of the point.

let parcoords1 =
    Chart.ParallelCoord(data,Color="blue")
// Dynamic object version
let parcoords = 
    let v = [|
        Dimensions.init([|1.;4.;|],  
            StyleParam.Range.MinMax (1.,5.),StyleParam.Range.MinMax (1.,2.),Label="A");
        Dimensions.init([|3.;1.5;|], 
            StyleParam.Range.MinMax (1.,5.),Label="B",Tickvals=[|1.5;3.;4.;5.;|]);
        Dimensions.init([|2.;4.;|],  
            StyleParam.Range.MinMax (1.,5.),Label="C",Tickvals=[|1.;2.;4.;5.;|],
                TickText=[|"txt 1";"txt 2";"txt 4";"txt 5";|]);
        Dimensions.init([|4.;2.;|],  
            StyleParam.Range.MinMax (1.,5.),Label="D");
    |]

    let dyn = Trace("parcoords")

    dyn?dimensions <- v
    dyn?line <- Line.init(Color = "blue")

    dyn
    |> GenericChart.ofTraceObject
namespace Plotly
namespace Plotly.NET
val data : (string * float list) list
val parcoords1 : GenericChart.GenericChart
type Chart =
  static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload
  static member Bar : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload
  static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?Showlegend:bool * ?Color:string * ?Fillcolor:'a2 * ?Opacity:float * ?Whiskerwidth:'a3 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a4 * ?Pointpos:'a5 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a6 * ?Offsetgroup:'a7 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload
  static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?StackGroup:string * ?Orientation:Orientation * ?GroupNorm:GroupNorm * ?UseWebGL:bool -> GenericChart + 1 overload
  static member Candlestick : open:seq<#IConvertible> * high:seq<#IConvertible> * low:seq<#IConvertible> * close:seq<#IConvertible> * x:seq<#IConvertible> * ?Increasing:Line * ?Decreasing:Line * ?WhiskerWidth:float * ?Line:Line * ?XCalendar:Calendar -> GenericChart + 1 overload
  static member ChoroplethMap : locations:seq<string> * z:seq<#IConvertible> * ?Text:seq<#IConvertible> * ?Locationmode:LocationFormat * ?Autocolorscale:bool * ?Colorscale:Colorscale * ?Colorbar:'a2 * ?Marker:Marker * ?GeoJson:'a3 * ?FeatureIdKey:string * ?Zmin:'a4 * ?Zmax:'a5 -> GenericChart
  static member Column : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload
  static member Contour : data:seq<#seq<'a1>> * ?X:seq<#IConvertible> * ?Y:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Opacity:float * ?Colorscale:Colorscale * ?Showscale:'a4 * ?zSmooth:SmoothAlg * ?Colorbar:'a5 -> GenericChart (requires 'a1 :> IConvertible)
  static member Doughnut : values:seq<#IConvertible> * ?Labels:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Colors:seq<string> * ?Hole:float * ?TextPosition:TextPosition * ?TextFont:Font * ?Hoverinfo:string * ?Textinfo:'a2 * ?Opacity:float -> GenericChart + 1 overload
  static member Funnel : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Color:string * ?Line:Line * ?x0:'a3 * ?dX:float * ?y0:'a4 * ?dY:float * ?Width:float * ?Offset:float * ?Orientation:Orientation * ?Alignmentgroup:string * ?Offsetgroup:string * ?Cliponaxis:bool * ?Connector:FunnelConnector * ?Insidetextfont:Font * ?Outsidetextfont:Font -> GenericChart
  ...
static member Chart.ParallelCoord : dims:seq<Dimensions> * ?Color:string * ?Colorscale:StyleParam.Colorscale * ?Width:float * ?Dash:StyleParam.DrawingStyle * ?Domain:'a0 * ?Labelfont:'a1 * ?Tickfont:Font * ?Rangefont:Font -> GenericChart.GenericChart
static member Chart.ParallelCoord : dims:seq<#System.IConvertible * #seq<'values>> * ?Range:StyleParam.Range * ?Constraintrange:StyleParam.Range * ?Color:string * ?Colorscale:StyleParam.Colorscale * ?Width:float * ?Dash:StyleParam.DrawingStyle * ?Domain:'b * ?Labelfont:'c * ?Tickfont:Font * ?Rangefont:Font -> GenericChart.GenericChart (requires 'values :> System.IConvertible)
module GenericChart

from Plotly.NET
val toChartHTML : gChart:GenericChart.GenericChart -> string
val parcoords : GenericChart.GenericChart
val v : Dimensions []
Multiple items
type Dimensions =
  inherit DynamicObj
  new : unit -> Dimensions
  static member init : ?Values:seq<#IConvertible> * ?Range:Range * ?Constraintrange:Range * ?Visible:bool * ?Label:#IConvertible * ?Tickvals:seq<#IConvertible> * ?TickText:seq<#IConvertible> * ?TickFormat:TickMode -> Dimensions
  static member style : ?Values:seq<#IConvertible> * ?Range:Range * ?Constraintrange:Range * ?Visible:bool * ?Label:#IConvertible * ?Tickvals:seq<#IConvertible> * ?TickText:seq<#IConvertible> * ?TickFormat:TickMode -> (Dimensions -> Dimensions)

--------------------
new : unit -> Dimensions
static member Dimensions.init : ?Values:seq<#System.IConvertible> * ?Range:StyleParam.Range * ?Constraintrange:StyleParam.Range * ?Visible:bool * ?Label:#System.IConvertible * ?Tickvals:seq<#System.IConvertible> * ?TickText:seq<#System.IConvertible> * ?TickFormat:StyleParam.TickMode -> Dimensions
module StyleParam

from Plotly.NET
type Range =
  | MinMax of float * float
  | Values of float array
    static member convert : (Range -> obj)
union case StyleParam.Range.MinMax: float * float -> StyleParam.Range
val dyn : Trace
Multiple items
module Trace

from Plotly.NET

--------------------
type Trace =
  inherit DynamicObj
  new : traceTypeName:string -> Trace
  member type : string

--------------------
new : traceTypeName:string -> Trace
Multiple items
type Line =
  inherit DynamicObj
  new : unit -> Line
  static member init : ?Width:float * ?Color:string * ?Shape:Shape * ?Dash:DrawingStyle * ?Smoothing:float * ?Colorscale:Colorscale * ?OutlierColor:string * ?OutlierWidth:float -> Line
  static member style : ?Width:float * ?Color:string * ?Shape:Shape * ?Dash:DrawingStyle * ?Smoothing:float * ?Colorscale:Colorscale * ?OutlierColor:string * ?OutlierWidth:float -> (Line -> Line)

--------------------
new : unit -> Line
static member Line.init : ?Width:float * ?Color:string * ?Shape:StyleParam.Shape * ?Dash:StyleParam.DrawingStyle * ?Smoothing:float * ?Colorscale:StyleParam.Colorscale * ?OutlierColor:string * ?OutlierWidth:float -> Line
val ofTraceObject : trace:Trace -> GenericChart.GenericChart