Skip to content

Add missing 3D charts and related layout options #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/1_0_axis-styling.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ let twoXAxes1 =
|> Chart.withYAxisStyle(
"axis 1",
Side=StyleParam.Side.Left,
Id=1
Id=StyleParam.SubPlotId.YAxis 1
)
|> Chart.withYAxisStyle(
"axis2",
Side=StyleParam.Side.Right,
Id=2,
Overlaying=StyleParam.AxisAnchorId.Y 1
Id=StyleParam.SubPlotId.YAxis 2,
Overlaying=StyleParam.LinearAxisId.Y 1
)

(*** condition: ipynb ***)
Expand Down Expand Up @@ -169,10 +169,10 @@ let twoXAxes2 =
|> Chart.withYAxisStyle(
"second y-axis",
Side=StyleParam.Side.Left,
Id=2,
Overlaying=StyleParam.AxisAnchorId.Y 1,
Id=StyleParam.SubPlotId.YAxis 2,
Overlaying=StyleParam.LinearAxisId.Y 1,
Position=0.10, // position the axis beteen the leftmost edge and the firt axis at 0.3
Anchor=StyleParam.AxisAnchorId.Free,
//Anchor=StyleParam.AxisAnchorId.Free,
ShowLine=true
)

Expand Down
4 changes: 1 addition & 3 deletions docs/2_7_heatmaps.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ Here is an example that adds a title to the colorbar:
let heat2 =
heat1
|> Chart.withColorBarStyle(
"Im the Colorbar",
TitleSide = StyleParam.Side.Right,
TitleFont = Font.init(Size=20.)
Title.init("Im the ColorBar")
)

(*** condition: ipynb ***)
Expand Down
67 changes: 54 additions & 13 deletions docs/3_0_3d-scatter-plots.fsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(**
---
title: 3D Scatter charts
title: 3D point and line charts
category: 3D Charts
categoryindex: 4
index: 1
Expand All @@ -22,38 +22,79 @@ index: 1
#endif // IPYNB

(**
# 3D Scatter charts
# 3D point plots
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
*Summary:* This example shows how to create three-dimensional scatter charts in F#.
*Summary:* This example shows how to create three-dimensional point and line charts in F#.
A Scatter3d chart report shows a three-dimensional spinnable view of your data
*)

open Plotly.NET

let x = [19; 26; 55;]
let y = [19; 26; 55;]
let z = [19; 26; 55;]

let scatter3d =
Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers)
|> Chart.withXAxisStyle("my x-axis")
|> Chart.withYAxisStyle("my y-axis")
let point3d =
Chart.Point3d(
[1,3,2; 6,5,4; 7,9,8],
Labels = ["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.)

(*** condition: ipynb ***)
#if IPYNB
scatter3d
point3d
#endif // IPYNB

(***hide***)
scatter3d |> GenericChart.toChartHTML
point3d |> GenericChart.toChartHTML
(*** include-it-raw ***)



(**
# 3D Line plots
*)

let line3d =
Chart.Line3d(
[1,3,2; 6,5,4; 7,9,8],
Labels = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter,
ShowMarkers = true
)

(*** condition: ipynb ***)
#if IPYNB
line3d
#endif // IPYNB

(***hide***)
line3d |> GenericChart.toChartHTML
(*** include-it-raw ***)

(**
# 3D Bubble plots
*)

let bubble3d =
Chart.Bubble3d(
[1,3,2; 6,5,4; 7,9,8],
[10;20;30],
Labels = ["A"; "B"; "C"],
TextPosition = StyleParam.TextPosition.BottomCenter
)

(*** condition: ipynb ***)
#if IPYNB
bubble3d
#endif // IPYNB

(***hide***)
bubble3d |> GenericChart.toChartHTML
(*** include-it-raw ***)
68 changes: 0 additions & 68 deletions docs/3_1_3d-line-plots.fsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title: 3D surface plots
category: 3D Charts
categoryindex: 4
index: 3
index: 2
---
*)

Expand Down
2 changes: 1 addition & 1 deletion docs/3_3_3d-mesh-plots.fsx → docs/3_2_3d-mesh-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title: 3D Mesh plots
category: 3D Charts
categoryindex: 4
index: 4
index: 3
---
*)

Expand Down
55 changes: 55 additions & 0 deletions docs/3_3_3d-cone-charts.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
(**
---
title: 3D Cone plots
category: 3D Charts
categoryindex: 4
index: 4
---
*)

(*** hide ***)

(*** condition: prepare ***)
#r "nuget: Newtonsoft.JSON, 12.0.3"
#r "nuget: DynamicObj"
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"

(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
#endif // IPYNB

(**
# 3D Cone plots
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
*Summary:* This example shows how to create 3D-Cone charts in F#.
*)

open System
open Plotly.NET


let cone =
Chart.Cone(
x = [1; 1; 1],
y = [1; 2; 3],
z = [1; 1; 1],
u = [1; 2; 3],
v = [1; 1; 2],
w = [4; 4; 1]
)

(*** condition: ipynb ***)
#if IPYNB
cone
#endif // IPYNB

(***hide***)
cone |> GenericChart.toChartHTML
(*** include-it-raw ***)
71 changes: 71 additions & 0 deletions docs/3_4_3d-streamtube-plots.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(**
---
title: 3D streamtube plots
category: 3D Charts
categoryindex: 4
index: 5
---
*)

(*** hide ***)

(*** condition: prepare ***)
#r "nuget: Newtonsoft.JSON, 12.0.3"
#r "nuget: DynamicObj"
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"

(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
#endif // IPYNB

(**
# 3D Mesh plots
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
*Summary:* This example shows how to create 3D-StreamTube charts in F#.
let's first create some data for the purpose of creating example charts:
*)

#r "nuget: Deedle"
#r "nuget: FSharp.Data"
open Deedle
open FSharp.Data
open System
open Plotly.NET

let tubeData =
Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv"
|> Frame.ReadCsvString

let streamTube =
Chart.StreamTube(
x = (tubeData.["x"] |> Series.values),
y = (tubeData.["y"] |> Series.values),
z = (tubeData.["z"] |> Series.values),
u = (tubeData.["u"] |> Series.values),
v = (tubeData.["v"] |> Series.values),
w = (tubeData.["w"] |> Series.values),
Starts =
StreamTubeStarts.init(
X = Array.init 16 (fun _ -> 80),
Y = [20;30;40;50;20;30;40;50;20;30;40;50;20;30;40;50],
Z = [0;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15]
),
ColorScale = StyleParam.Colorscale.Viridis
)


(*** condition: ipynb ***)
#if IPYNB
streamTube
#endif // IPYNB

(***hide***)
streamTube |> GenericChart.toChartHTML
(*** include-it-raw ***)
Loading