Summary: This example shows how to create three-dimensional point and line charts in F#.
Point3D, Line3D, and Bubble3D charts are all derived from Chart.Scatter3D
and can be generated by that function as well.
However, Chart.Point3D
, Chart.Line3D
, or Chart.Bubble3D
provide sensible defaults and arguments for the respective derived chart, and are recommended to use.
open Plotly.NET
let point3d =
Chart.Point3D(
[1,3,2; 6,5,4; 7,9,8],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter
)
|> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1) // in contrast to 2D plots, x and y axes of 3D charts have to be set via the scene object
|> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1) // in contrast to 2D plots, x and y axes of 3D charts have to be set via the scene object
|> Chart.withZAxisStyle("my z-axis")
|> Chart.withSize(800.,800.)
let point3d2 =
Chart.Point3D(
[1,3,2; 6,5,4; 7,9,8],
MarkerColor = Color.fromColorScaleValues [0;1;2],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter
)
let line3d =
Chart.Line3D(
[1,3,2; 6,5,4; 7,9,8],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter,
ShowMarkers = true
)
let line3d2 =
Chart.Line3D(
[1,3,2; 6,5,4; 7,9,8],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter,
ShowMarkers = true,
LineColor = Color.fromColorScaleValues [0;1;2],
LineWidth = 10.
)
let bubble3d =
Chart.Bubble3D(
[1,3,2; 6,5,4; 7,9,8],
[10;20;30],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter
)
let bubble3d2 =
Chart.Bubble3D(
[1,3,2; 6,5,4; 7,9,8],
[10;20;30],
MultiText = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter,
MarkerColor = Color.fromColorScaleValues [0;1;2],
MarkerColorScale = StyleParam.Colorscale.Viridis
)