Built-in Continuous Color Scales in F#
A reference for the built-in named continuous (sequential, diverging and cyclical) color scales in Plotly.
In [1]:
#r "nuget: Plotly.NET, 2.0.0-preview.8"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.8"
Built-in and Custom color scales¶
The following built-in continuous color scales are available. Through Custom Colorscale, you can define custom colors
In [2]:
open Microsoft.FSharp.Reflection
open Plotly.NET
let builtinColorScales = FSharpType.GetUnionCases typeof<StyleParam.Colorscale>
for case in builtinColorScales do printfn "%s" case.Name
In [3]:
open Plotly.NET
let matrix =
[[1.;1.5;0.7;2.7];
[2.;0.5;1.2;1.4];
[0.1;2.6;2.4;3.0];]
let rownames = ["p3";"p2";"p1"]
let colnames = ["Tp0";"Tp30";"Tp60";"Tp160"]
let colorscaleValue =
StyleParam.Colorscale.Custom [(0.0,"#3D9970");(1.0,"#001f3f")] //StyleParam.Colorscale.Blackbody or StyleParam.Colorscale.Bluered etc
Chart.Heatmap(
data=matrix,ColNames=colnames,RowNames=rownames,
Colorscale=colorscaleValue,
Showscale=true
)
|> Chart.withSize(700.,500.)
|> Chart.withMarginSize(Left=200.)
Out[3]: