XPlot


Plotly Heatmaps

Binder

Basic Heatmap

open XPlot.Plotly

let layout = Layout(title = "Basic Heatmap")

let chart1 =
    Heatmap(
        z = [[1; 20; 30]; [20; 1; 60]; [30; 60; 1]]
    )
    |> Chart.Plot
    |> Chart.WithLayout layout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500

Heatmap with Categorical Axis Labels

let categoricalLayout = Layout(title = "Heatmap with Categorical Axis Labels")

let chart2 =
    Heatmap(
        z = [[1; 20; 30; 50; 1]; [20; 1; 60; 80; 30]; [30; 60; 1; -10; 20]],
        x = ["Monday"; "Tuesday"; "Wednesday"; "Thursday"; "Friday"],
        y = ["Morning"; "Afternoon"; "Evening"]
    )
    |> Chart.Plot
    |> Chart.WithLayout categoricalLayout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500

Custom Colorscale

let customZ =
    [
        for x in 1 .. 50 do
            let lst = List.map (fun y -> y + x) [1..50]
            yield lst
    ]

let colorScale =
    [
        [box 0.0; box "rgb(165,0,38)"]
        [0.1111111111111111; "rgb(215,48,39)"]
        [0.2222222222222222; "rgb(244,109,67)"]
        [0.3333333333333333; "rgb(253,174,97)"]
        [0.4444444444444444; "rgb(254,224,144)"]
        [0.5555555555555556; "rgb(224,243,248)"]
        [0.6666666666666666; "rgb(171,217,233)"]
        [0.7777777777777778; "rgb(116,173,209)"]
        [0.8888888888888888; "rgb(69,117,180)"]
        [1.0; "rgb(49,54,149)"]
    ]

let customLayout = Layout(title = "Custom Colorscale")

let chart3 =
    Heatmap(
        z = customZ,
        colorscale = colorScale
    )
    |> Chart.Plot
    |> Chart.WithLayout customLayout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500

Earth Colorscale

let earthZ =
    [
        for x in 1 .. 50 ->
            List.map (fun y -> y + x) [1..50]
    ]

let earthLayout = Layout(title = "Earth Colorscale")

let chart4 =
    Heatmap(
        z = earthZ,
        colorscale = "Earth"
    )
    |> Chart.Plot
    |> Chart.WithLayout earthLayout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500

YIGnBu Colorscale

let yignbuZ =
    [
        for x in 1 .. 50 ->
            List.map (fun y -> y + x) [1..50]
    ]

let yignbuLayout = Layout(title = "YIGnBu Colorscale")

let chart5 =
    Heatmap(
        z = yignbuZ,
        colorscale = "YIGnBu"
    )
    |> Chart.Plot
    |> Chart.WithLayout yignbuLayout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500
namespace XPlot
namespace XPlot.Plotly
val layout : Layout
Multiple items
module Layout

from XPlot.Plotly

--------------------
type Layout =
  new : unit -> Layout
  member ShouldSerializeangularaxis : unit -> bool
  member ShouldSerializeannotations : unit -> bool
  member ShouldSerializeautosize : unit -> bool
  member ShouldSerializebargap : unit -> bool
  member ShouldSerializebargroupgap : unit -> bool
  member ShouldSerializebarmode : unit -> bool
  member ShouldSerializeboxmode : unit -> bool
  member ShouldSerializedirection : unit -> bool
  member ShouldSerializedragmode : unit -> bool
  ...

--------------------
new : unit -> Layout
val chart1 : PlotlyChart
Multiple items
type Heatmap =
  inherit Trace
  new : unit -> Heatmap
  member ShouldSerializeautocolorscale : unit -> bool
  member ShouldSerializecolorbar : unit -> bool
  member ShouldSerializecolorscale : unit -> bool
  member ShouldSerializeconnectgaps : unit -> bool
  member ShouldSerializedx : unit -> bool
  member ShouldSerializedy : unit -> bool
  member ShouldSerializehoverinfo : unit -> bool
  member ShouldSerializelegendgroup : unit -> bool
  ...

--------------------
new : unit -> Heatmap
property Heatmap.z: obj with get, set
type Chart =
  static member Area : data:seq<#value> -> PlotlyChart + 2 overloads
  static member Bar : data:seq<#value> -> PlotlyChart + 2 overloads
  static member Bubble : data:seq<#key * #value * #value> -> PlotlyChart
  static member Candlestick : data:seq<#key * #value * #value * #value * #value> -> PlotlyChart
  static member Column : data:seq<#value> -> PlotlyChart + 2 overloads
  static member Line : data:seq<#value> -> PlotlyChart + 2 overloads
  static member Pie : data:seq<#key * #value> -> PlotlyChart
  static member Plot : data:Trace -> PlotlyChart + 3 overloads
  static member Scatter : data:seq<#value> -> PlotlyChart + 2 overloads
  static member Show : chart:PlotlyChart -> unit
  ...
static member Chart.Plot : data:seq<#Trace> -> PlotlyChart
static member Chart.Plot : data:Trace -> PlotlyChart
static member Chart.Plot : data:seq<#Trace> * layout:Layout -> PlotlyChart
static member Chart.Plot : data:Trace * layout:Layout -> PlotlyChart
static member Chart.WithLayout : layout:Layout -> chart:PlotlyChart -> PlotlyChart
static member Chart.WithWidth : width:int -> chart:PlotlyChart -> PlotlyChart
static member Chart.WithHeight : height:int -> chart:PlotlyChart -> PlotlyChart
member PlotlyChart.GetHtml : unit -> string
val categoricalLayout : Layout
val chart2 : PlotlyChart
property Heatmap.x: obj with get, set
property Heatmap.y: obj with get, set
val customZ : int list list
val x : int
val lst : int list
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
    interface IReadOnlyList<'T>
    interface IReadOnlyCollection<'T>
    interface IEnumerable
    interface IEnumerable<'T>
    member GetReverseIndex : rank:int * offset:int -> int
    member GetSlice : startIndex:int option * endIndex:int option -> 'T list
    static member Cons : head:'T * tail:'T list -> 'T list
    member Head : 'T
    member IsEmpty : bool
    member Item : index:int -> 'T with get
    ...
val map : mapping:('T -> 'U) -> list:'T list -> 'U list
val y : int
val colorScale : obj list list
val box : value:'T -> obj
val customLayout : Layout
val chart3 : PlotlyChart
val earthZ : int list list
val earthLayout : Layout
val chart4 : PlotlyChart
val yignbuZ : int list list
val yignbuLayout : Layout
val chart5 : PlotlyChart