// can't yet format YamlFrontmatter (["title: 3D line charts"; "category: 3D Charts"; "categoryindex: 4"; "index: 2"], Some { StartLine = 2 StartColumn = 0 EndLine = 6 EndColumn = 8 }) to pynb markdown

In [ ]:
#r "nuget: Plotly.NET, 2.0.0-preview.6"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.6"

3D line charts

BinderScriptNotebook

Summary: This example shows how to create three-dimensional scatter charts in F#.

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

In [3]:
open Plotly.NET 
open System
 
let c = [0. .. 0.5 .. 15.]

let x,y,z =  
    c
    |> List.map (fun i ->
        let i' = float i 
        let r = 10. * Math.Cos (i' / 10.)
        (r*Math.Cos i',r*Math.Sin i',i')
    )
    |> List.unzip3

A Scatter3 chart shows a three-dimensional spinnable view of your data. When using Lines_Markers as the mode of the chart, you additionally render a line between the points:

In [4]:
let scatter3dLine = 
    Chart.Scatter3d(x,y,z,StyleParam.Mode.Lines_Markers)
    |> Chart.withX_AxisStyle("x-axis")
    |> Chart.withY_AxisStyle("y-axis")
    |> Chart.withZ_AxisStyle("z-axis")
    |> Chart.withSize(800.,800.)
In [ ]:
scatter3dLine
Out[ ]: