XPlot


Plotly 3D Line Plots

Binder

3D Random Walk

open System.IO
open XPlot.Plotly

let data =
    Path.Combine(__SOURCE_DIRECTORY__, "3DLineData.txt")
    |> File.ReadAllLines

let getData line =
    data.[line]
    |> fun x -> x.Split ','
    |> Array.map float

let x1 = getData 0
let y1 = getData 1
let z1 = getData 2
let x2 = getData 3
let y2 = getData 4
let z2 = getData 5
let x3 = getData 6
let y3 = getData 7
let z3 = getData 8

let trace1 =
    Scatter3d(
        x = x1,
        y = y1,
        z = z1,
        mode = "lines",
        marker =
            Marker(
                color = "#1f77b4",
                size = 12.,
                symbol = "circle",
                line =
                    Line(
                        color = "rgb(0,0,0)",
                        width = 0.
                    )
            ),
        line =
            Line(
                color = "#1f77b4",
                width = 1.
            )
    )

let trace2 =
    Scatter3d(
        x = x2,
        y= y2,
        z = z2,
        mode = "lines",
        marker =
            Marker(
                color = "#9467bd",
                size = 12.,
                symbol = "circle",
                line =
                    Line(
                        color = "rgb(0,0,0)",
                        width = 0.
                    )
            ),
        line =
            Line(
                color = "rgb(44, 160, 44)",
                width = 1.
            )
    )

let trace3 =
    Scatter3d(
        x = x3,
        y = y3,
        z = z3,
        mode = "lines",
        marker =
            Marker(
                color = "#bcbd22",
                size = 12.,
                symbol = "circle",
                line =
                    Line(
                        color = "rgb(0,0,0)",
                        width = 0.
                    )
            ),
        line =
            Line(
                color = "#bcbd22",
                width = 1.
            )
    )

let layout =
    Layout(
        title = "3D Random Walk",
        autosize = false,
        margin =
            Margin(
                l = 0.,
                r = 0.,
                b = 0.,
                t = 65.
            )
    )
let chart =
    [trace1; trace2; trace3]
    |> Chart.Plot
    |> Chart.WithLayout layout
    |> Chart.WithWidth 700
    |> Chart.WithHeight 500
namespace System
namespace System.IO
namespace XPlot
namespace XPlot.Plotly
val data : string []
type Path =
  static member ChangeExtension : path: string * extension: string -> string
  static member Combine : path1: string * path2: string -> string + 3 overloads
  static member EndsInDirectorySeparator : path: ReadOnlySpan<char> -> bool + 1 overload
  static member GetDirectoryName : path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload
  static member GetExtension : path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload
  static member GetFileName : path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload
  static member GetFileNameWithoutExtension : path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload
  static member GetFullPath : path: string -> string + 1 overload
  static member GetInvalidFileNameChars : unit -> char []
  static member GetInvalidPathChars : unit -> char []
  ...
Path.Combine([<System.ParamArray>] paths: string []) : string
Path.Combine(path1: string, path2: string) : string
Path.Combine(path1: string, path2: string, path3: string) : string
Path.Combine(path1: string, path2: string, path3: string, path4: string) : string
type File =
  static member AppendAllLines : path: string * contents: IEnumerable<string> -> unit + 1 overload
  static member AppendAllLinesAsync : path: string * contents: IEnumerable<string> * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
  static member AppendAllText : path: string * contents: string -> unit + 1 overload
  static member AppendAllTextAsync : path: string * contents: string * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
  static member AppendText : path: string -> StreamWriter
  static member Copy : sourceFileName: string * destFileName: string -> unit + 1 overload
  static member Create : path: string -> FileStream + 2 overloads
  static member CreateText : path: string -> StreamWriter
  static member Decrypt : path: string -> unit
  static member Delete : path: string -> unit
  ...
File.ReadAllLines(path: string) : string []
File.ReadAllLines(path: string, encoding: System.Text.Encoding) : string []
val getData : line:int -> float []
val line : int
val x : string
System.String.Split([<System.ParamArray>] separator: char []) : string []
System.String.Split(separator: string [], options: System.StringSplitOptions) : string []
System.String.Split(separator: string,?options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int) : string []
System.String.Split(separator: char,?options: System.StringSplitOptions) : string []
System.String.Split(separator: string [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: string, count: int,?options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: char, count: int,?options: System.StringSplitOptions) : string []
module Array

from Microsoft.FSharp.Collections
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
Multiple items
val float : value:'T -> float (requires member op_Explicit)

--------------------
[<Struct>]
type float = System.Double

--------------------
type float<'Measure> =
  float
val x1 : float []
val y1 : float []
val z1 : float []
val x2 : float []
val y2 : float []
val z2 : float []
val x3 : float []
val y3 : float []
val z3 : float []
val trace1 : Scatter3d
Multiple items
type Scatter3d =
  inherit Trace
  new : unit -> Scatter3d
  member ShouldSerializeerror_x : unit -> bool
  member ShouldSerializeerror_y : unit -> bool
  member ShouldSerializeerror_z : unit -> bool
  member ShouldSerializehoverinfo : unit -> bool
  member ShouldSerializelegendgroup : unit -> bool
  member ShouldSerializeline : unit -> bool
  member ShouldSerializemarker : unit -> bool
  member ShouldSerializemode : unit -> bool
  ...

--------------------
new : unit -> Scatter3d
property Scatter3d.x: obj with get, set
property Scatter3d.y: obj with get, set
property Scatter3d.z: obj with get, set
Multiple items
type Marker =
  new : unit -> Marker
  member ShouldSerializeautocolorscale : unit -> bool
  member ShouldSerializecauto : unit -> bool
  member ShouldSerializecmax : unit -> bool
  member ShouldSerializecmin : unit -> bool
  member ShouldSerializecolor : unit -> bool
  member ShouldSerializecolorbar : unit -> bool
  member ShouldSerializecolors : unit -> bool
  member ShouldSerializecolorscale : unit -> bool
  member ShouldSerializecolorsrc : unit -> bool
  ...

--------------------
new : unit -> Marker
Multiple items
type Line =
  new : unit -> Line
  member ShouldSerializeautocolorscale : unit -> bool
  member ShouldSerializecauto : unit -> bool
  member ShouldSerializecmax : unit -> bool
  member ShouldSerializecmin : unit -> bool
  member ShouldSerializecolor : unit -> bool
  member ShouldSerializecolorscale : unit -> bool
  member ShouldSerializecolorsrc : unit -> bool
  member ShouldSerializedash : unit -> bool
  member ShouldSerializeoutliercolor : unit -> bool
  ...

--------------------
new : unit -> Line
val trace2 : Scatter3d
val trace3 : Scatter3d
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
Multiple items
type Margin =
  new : unit -> Margin
  member ShouldSerializeautoexpand : unit -> bool
  member ShouldSerializeb : unit -> bool
  member ShouldSerializel : unit -> bool
  member ShouldSerializepad : unit -> bool
  member ShouldSerializer : unit -> bool
  member ShouldSerializet : unit -> bool
  member autoexpand : bool
  member b : float
  member l : float
  ...

--------------------
new : unit -> Margin
property Margin.l: float with get, set
property Margin.r: float with get, set
property Margin.b: float with get, set
property Margin.t: float with get, set
val chart : PlotlyChart
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