Carpet charts

BinderScriptNotebook

Summary: This example shows how to create carpet charts in F#.

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

open Plotly.NET 
  
//carpet coordinate data
let a = [4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.]
let b = [1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.]
let y = [2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.]

//carpet plot data
let aData = [4.; 5.; 5.; 6.]
let bData = [1.; 1.; 2.; 3.]
let sizes = [5; 10; 15; 20]

A carpet plot is any of a few different specific types of plot. The more common plot referred to as a carpet plot is one that illustrates the interaction between two or more independent variables and one or more dependent variables in a two-dimensional plot.

Besides the ability to incorporate more variables, another feature that distinguishes a carpet plot from an equivalent contour plot or 3D surface plot is that a carpet plot can be used to more accurately interpolate data points.

A conventional carpet plot can capture the interaction of up to three independent variables and three dependent variables and still be easily read and interpolated.

Carpet plots have common applications within areas such as material science for showing elastic modulus in laminates,and within aeronautics.

A carpet plot with two independent variables and one dependent variable is often called a cheater plot for the use of a phantom "cheater" axis instead of the horizontal axis.

(https://en.wikipedia.org/wiki/Carpet_plot)

Carpet Traces

In plotly, carpet plots are different to all other trace types in the regard that the coordinate system of the carpet is not set on the layout, but is itself a trace.

Use Chart.Carpet to define these coordinate traces. All carpets have a mandatory identifier, which will be used by other traces to define which carpet coordinate system to use.

let carpet = Chart.Carpet("carpetIdentifier", A = a, B = b, Y = y)

Carpet point charts

use Chart.PointCarpet to create a point plot on the referenced carpet coordinate system:

let carpetPoint = 
    [
        carpet
        Chart.PointCarpet(aData,bData,"carpetIdentifier", Name = "Point")
    ]
    |> Chart.combine

Carpet line charts

use Chart.LineCarpet to create a line plot on the referenced carpet coordinate system:

let carpetLine = 
    [
        carpet
        Chart.LineCarpet(aData,bData,"carpetIdentifier",Name = "Line")
    ]
    |> Chart.combine

Carpet Spline charts

use Chart.LineCarpet to create a spline plot on the referenced carpet coordinate system:

let carpetSpline = 
    [
        carpet
        Chart.SplineCarpet(aData,bData,"carpetIdentifier",Name = "Spline")
    ]
    |> Chart.combine

Carpet bubble charts

use Chart.LineCarpet to create a bubble plot on the referenced carpet coordinate system:

let carpetBubble = 
    [
        carpet
        Chart.BubbleCarpet((Seq.zip3 aData bData sizes),"carpetIdentifier",Name = "Bubble")
    ]
    |> Chart.combine
namespace Plotly
namespace Plotly.NET
val a : float list
val b : float list
val y : float list
val aData : float list
val bData : float list
val sizes : int list
val carpet : GenericChart.GenericChart
type Chart = static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?ShowLegend:bool * ?MarkerSymbol:MarkerSymbol * ?Color:Color * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload static member Bar : values:seq<#IConvertible> * ?Keys:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?PatternShape:PatternShape * ?MultiPatternShape:seq<PatternShape> * ?Pattern:Pattern * ?Base:#IConvertible * ?Width:'a3 * ?MultiWidth:seq<'a3> * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a4 * ?MultiText:seq<'a4> * ?TextPosition:TextPosition * ?MultiTextPosition:seq<TextPosition> * ?TextFont:Font * ?Marker:Marker -> GenericChart (requires 'a3 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?Fillcolor:Color * ?Opacity:float * ?Whiskerwidth:'a2 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a3 * ?Pointpos:'a4 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a5 * ?Offsetgroup:'a6 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<int> * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:MarkerSymbol * ?Color:Color * ?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 Column : values:seq<#IConvertible> * ?Keys:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?Pattern:Pattern * ?PatternShape:PatternShape * ?MultiPatternShape:seq<PatternShape> * ?Base:#IConvertible * ?Width:'a3 * ?MultiWidth:seq<'a3> * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a4 * ?MultiText:seq<'a4> * ?TextPosition:TextPosition * ?MultiTextPosition:seq<TextPosition> * ?TextFont:Font * ?Marker:Marker -> GenericChart (requires 'a3 :> IConvertible and 'a4 :> IConvertible) + 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 Funnel : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Color:Color * ?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 Heatmap : data:seq<#seq<'a1>> * ?ColNames:seq<#IConvertible> * ?RowNames:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Colorscale:Colorscale * ?Showscale:'a4 * ?Xgap:'a5 * ?Ygap:'a6 * ?zSmooth:SmoothAlg * ?ColorBar:'a7 * ?UseWebGL:bool -> GenericChart (requires 'a1 :> IConvertible) static member Histogram : data:seq<#IConvertible> * ?Orientation:Orientation * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Color:Color * ?HistNorm:HistNorm * ?HistFunc:HistFunc * ?nBinsx:int * ?nBinsy:int * ?Xbins:Bins * ?Ybins:Bins * ?xError:'a1 * ?yError:'a2 -> GenericChart ...
static member Chart.Carpet : carpetId:string * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?X:seq<#System.IConvertible> * ?MultiX:seq<#seq<'c>> * ?Y:seq<#System.IConvertible> * ?MultiY:seq<#seq<'f>> * ?A:seq<#System.IConvertible> * ?B:seq<#System.IConvertible> * ?AAxis:LayoutObjects.LinearAxis * ?BAxis:LayoutObjects.LinearAxis * ?XAxis:StyleParam.LinearAxisId * ?YAxis:StyleParam.LinearAxisId * ?Color:Color * ?CheaterSlope:float -> GenericChart.GenericChart (requires 'c :> System.IConvertible and 'f :> System.IConvertible)
argument A: seq<float> option
<summary> Shows how proportions of data, shown as pie-shaped pieces, contribute to the data. </summary>
argument B: seq<float> option
<summary> Shows how proportions of data, shown as pie-shaped pieces, contribute to the data. </summary>
argument Y: seq<float> option
<summary> Shows how proportions of data, shown as pie-shaped pieces, contribute to the data. </summary>
module GenericChart from Plotly.NET
<summary> Module to represent a GenericChart </summary>
val toChartHTML : gChart:GenericChart.GenericChart -> string
<summary> Converts a GenericChart to it HTML representation. The div layer has a default size of 600 if not specified otherwise. </summary>
val carpetPoint : GenericChart.GenericChart
static member Chart.PointCarpet : ab:seq<#System.IConvertible * #System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a2 * ?MultiText:seq<'a2> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'a2 :> System.IConvertible)
static member Chart.PointCarpet : a:seq<#System.IConvertible> * b:seq<#System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'c * ?MultiText:seq<'c> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'c :> System.IConvertible)
static member Chart.combine : gCharts:seq<GenericChart.GenericChart> -> GenericChart.GenericChart
val carpetLine : GenericChart.GenericChart
static member Chart.LineCarpet : ab:seq<#System.IConvertible * #System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowMarkers:bool * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?Line:Line * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a2 * ?MultiText:seq<'a2> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'a2 :> System.IConvertible)
static member Chart.LineCarpet : a:seq<#System.IConvertible> * b:seq<#System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowMarkers:bool * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?Line:Line * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'c * ?MultiText:seq<'c> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'c :> System.IConvertible)
val carpetSpline : GenericChart.GenericChart
static member Chart.SplineCarpet : ab:seq<#System.IConvertible * #System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowMarkers:bool * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?Smoothing:float * ?Line:Line * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a2 * ?MultiText:seq<'a2> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'a2 :> System.IConvertible)
static member Chart.SplineCarpet : a:seq<#System.IConvertible> * b:seq<#System.IConvertible> * carpetAnchorId:string * ?Name:string * ?ShowMarkers:bool * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?Smoothing:float * ?Line:Line * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'c * ?MultiText:seq<'c> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Size:int * ?MultiSize:seq<int> * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'c :> System.IConvertible)
val carpetBubble : GenericChart.GenericChart
static member Chart.BubbleCarpet : absizes:seq<#System.IConvertible * #System.IConvertible * int> * carpetAnchorId:string * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'c * ?MultiText:seq<'c> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'c :> System.IConvertible)
static member Chart.BubbleCarpet : a:seq<#System.IConvertible> * b:seq<#System.IConvertible> * sizes:seq<int> * carpetAnchorId:string * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?MultiMarkerSymbol:seq<StyleParam.MarkerSymbol> * ?Color:Color * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a2 * ?MultiText:seq<'a2> * ?TextPosition:StyleParam.TextPosition * ?MultiTextPosition:seq<StyleParam.TextPosition> * ?TextFont:Font * ?Marker:TraceObjects.Marker -> GenericChart.GenericChart (requires 'a2 :> System.IConvertible)
Multiple items
module Seq from Plotly.NET

--------------------
module Seq from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>
val zip3 : source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'T1 * 'T2 * 'T3>
<summary>Combines the three sequences into a list of triples. The sequences need not have equal lengths: when one sequence is exhausted any remaining elements in the other sequences are ignored.</summary>
<param name="source1">The first input sequence.</param>
<param name="source2">The second input sequence.</param>
<param name="source3">The third input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when any of the input sequences is null.</exception>