XPlot


Plotly Contour Plots

Binder

Basic Contour Plot

open System
open MathNet.Numerics
open XPlot.Plotly

let size = 100

let x = Generate.LinearSpaced(size, -2. * Math.PI, 2. * Math.PI)
let y = Generate.LinearSpaced(size, -2. * Math.PI, 2. * Math.PI)
let z = Array2D.create size size 0.

for i in 0 .. 99 do
    for j in 0 .. 99 do
        let r2 = x.[i] ** 2. + y.[j] ** 2.
        z.[i,j] <- sin x.[i] * cos y.[j] * sin r2 / log(r2 + 1.)

let chart =
    Contour(
        z = z,
        x = x,
        y = y
    )
    |> Chart.Plot
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500
namespace System
namespace MathNet
namespace MathNet.Numerics
namespace XPlot
namespace XPlot.Plotly
val size : int
val x : float []
type Generate =
  static member Fibonacci : length: int -> BigInteger []
  static member FibonacciSequence : unit -> IEnumerable<BigInteger>
  static member Impulse : length: int * amplitude: float * delay: int -> float []
  static member ImpulseSequence : amplitude: float * delay: int -> IEnumerable<float>
  static member LinearRange : start: int * stop: int -> float [] + 2 overloads
  static member LinearRangeInt32 : start: int * stop: int -> int [] + 1 overload
  static member LinearRangeMap<'T> : start: float * step: float * stop: float * map: Func<float,'T> -> 'T []
  static member LinearSpaced : length: int * start: float * stop: float -> float []
  static member LinearSpacedMap<'T> : length: int * start: float * stop: float * map: Func<float,'T> -> 'T []
  static member LogSpaced : length: int * startExponent: float * stopExponent: float -> float []
  ...
Generate.LinearSpaced(length: int, start: float, stop: float) : float []
type Math =
  static member Abs : value: decimal -> decimal + 6 overloads
  static member Acos : d: float -> float
  static member Acosh : d: float -> float
  static member Asin : d: float -> float
  static member Asinh : d: float -> float
  static member Atan : d: float -> float
  static member Atan2 : y: float * x: float -> float
  static member Atanh : d: float -> float
  static member BigMul : a: int * b: int -> int64 + 2 overloads
  static member BitDecrement : x: float -> float
  ...
field Math.PI: float = 3.14159265359
val y : float []
val z : float [,]
module Array2D

from Microsoft.FSharp.Collections
val create : length1:int -> length2:int -> value:'T -> 'T [,]
val i : int32
val j : int32
val r2 : float
val sin : value:'T -> 'T (requires member Sin)
val cos : value:'T -> 'T (requires member Cos)
val log : value:'T -> 'T (requires member Log)
val chart : PlotlyChart
Multiple items
type Contour =
  inherit Trace
  new : unit -> Contour
  member ShouldSerializeautocolorscale : unit -> bool
  member ShouldSerializeautocontour : unit -> bool
  member ShouldSerializecolor : unit -> bool
  member ShouldSerializecolorbar : unit -> bool
  member ShouldSerializecolorscale : unit -> bool
  member ShouldSerializeconnectgaps : unit -> bool
  member ShouldSerializecontours : unit -> bool
  member ShouldSerializedx : unit -> bool
  ...

--------------------
new : unit -> Contour
property Contour.z: obj with get, set
property Contour.x: obj with get, set
property Contour.y: 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.WithWidth : width:int -> chart:PlotlyChart -> PlotlyChart
static member Chart.WithHeight : height:int -> chart:PlotlyChart -> PlotlyChart
member PlotlyChart.GetHtml : unit -> string