Skip to content

Commit 888bdf9

Browse files
authored
Merge pull request #125 from plotly/3D
2 parents 426c32d + b65ad7d commit 888bdf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3833
-1274
lines changed

docs/1_0_axis-styling.fsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ let twoXAxes1 =
127127
|> Chart.withYAxisStyle(
128128
"axis 1",
129129
Side=StyleParam.Side.Left,
130-
Id=1
130+
Id=StyleParam.SubPlotId.YAxis 1
131131
)
132132
|> Chart.withYAxisStyle(
133133
"axis2",
134134
Side=StyleParam.Side.Right,
135-
Id=2,
136-
Overlaying=StyleParam.AxisAnchorId.Y 1
135+
Id=StyleParam.SubPlotId.YAxis 2,
136+
Overlaying=StyleParam.LinearAxisId.Y 1
137137
)
138138

139139
(*** condition: ipynb ***)
@@ -169,10 +169,10 @@ let twoXAxes2 =
169169
|> Chart.withYAxisStyle(
170170
"second y-axis",
171171
Side=StyleParam.Side.Left,
172-
Id=2,
173-
Overlaying=StyleParam.AxisAnchorId.Y 1,
172+
Id=StyleParam.SubPlotId.YAxis 2,
173+
Overlaying=StyleParam.LinearAxisId.Y 1,
174174
Position=0.10, // position the axis beteen the leftmost edge and the firt axis at 0.3
175-
Anchor=StyleParam.AxisAnchorId.Free,
175+
//Anchor=StyleParam.AxisAnchorId.Free,
176176
ShowLine=true
177177
)
178178

docs/2_7_heatmaps.fsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ Here is an example that adds a title to the colorbar:
8080
let heat2 =
8181
heat1
8282
|> Chart.withColorBarStyle(
83-
"Im the Colorbar",
84-
TitleSide = StyleParam.Side.Right,
85-
TitleFont = Font.init(Size=20.)
83+
Title.init("Im the ColorBar")
8684
)
8785

8886
(*** condition: ipynb ***)

docs/3_0_3d-scatter-plots.fsx

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(**
22
---
3-
title: 3D Scatter charts
3+
title: 3D point and line charts
44
category: 3D Charts
55
categoryindex: 4
66
index: 1
@@ -22,38 +22,79 @@ index: 1
2222
#endif // IPYNB
2323

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

3636
open Plotly.NET
3737

38-
let x = [19; 26; 55;]
39-
let y = [19; 26; 55;]
40-
let z = [19; 26; 55;]
41-
42-
let scatter3d =
43-
Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers)
44-
|> Chart.withXAxisStyle("my x-axis")
45-
|> Chart.withYAxisStyle("my y-axis")
38+
let point3d =
39+
Chart.Point3d(
40+
[1,3,2; 6,5,4; 7,9,8],
41+
Labels = ["A"; "B"; "C"],
42+
TextPosition = StyleParam.TextPosition.BottomCenter
43+
)
44+
|> 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
45+
|> 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
4646
|> Chart.withZAxisStyle("my z-axis")
4747
|> Chart.withSize(800.,800.)
4848

4949
(*** condition: ipynb ***)
5050
#if IPYNB
51-
scatter3d
51+
point3d
5252
#endif // IPYNB
5353

5454
(***hide***)
55-
scatter3d |> GenericChart.toChartHTML
55+
point3d |> GenericChart.toChartHTML
5656
(*** include-it-raw ***)
5757

5858

5959

60+
(**
61+
# 3D Line plots
62+
*)
63+
64+
let line3d =
65+
Chart.Line3d(
66+
[1,3,2; 6,5,4; 7,9,8],
67+
Labels = ["A"; "B"; "C"],
68+
TextPosition = StyleParam.TextPosition.BottomCenter,
69+
ShowMarkers = true
70+
)
71+
72+
(*** condition: ipynb ***)
73+
#if IPYNB
74+
line3d
75+
#endif // IPYNB
76+
77+
(***hide***)
78+
line3d |> GenericChart.toChartHTML
79+
(*** include-it-raw ***)
80+
81+
(**
82+
# 3D Bubble plots
83+
*)
84+
85+
let bubble3d =
86+
Chart.Bubble3d(
87+
[1,3,2; 6,5,4; 7,9,8],
88+
[10;20;30],
89+
Labels = ["A"; "B"; "C"],
90+
TextPosition = StyleParam.TextPosition.BottomCenter
91+
)
92+
93+
(*** condition: ipynb ***)
94+
#if IPYNB
95+
bubble3d
96+
#endif // IPYNB
97+
98+
(***hide***)
99+
bubble3d |> GenericChart.toChartHTML
100+
(*** include-it-raw ***)

docs/3_1_3d-line-plots.fsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

docs/3_2_3d-surface-plots.fsx renamed to docs/3_1_3d-surface-plots.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title: 3D surface plots
44
category: 3D Charts
55
categoryindex: 4
6-
index: 3
6+
index: 2
77
---
88
*)
99

docs/3_3_3d-mesh-plots.fsx renamed to docs/3_2_3d-mesh-plots.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title: 3D Mesh plots
44
category: 3D Charts
55
categoryindex: 4
6-
index: 4
6+
index: 3
77
---
88
*)
99

docs/3_3_3d-cone-charts.fsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
(**
2+
---
3+
title: 3D Cone plots
4+
category: 3D Charts
5+
categoryindex: 4
6+
index: 4
7+
---
8+
*)
9+
10+
(*** hide ***)
11+
12+
(*** condition: prepare ***)
13+
#r "nuget: Newtonsoft.JSON, 12.0.3"
14+
#r "nuget: DynamicObj"
15+
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"
16+
17+
(*** condition: ipynb ***)
18+
#if IPYNB
19+
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
20+
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
21+
#endif // IPYNB
22+
23+
(**
24+
# 3D Cone plots
25+
26+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
27+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
28+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
29+
30+
*Summary:* This example shows how to create 3D-Cone charts in F#.
31+
32+
*)
33+
34+
open System
35+
open Plotly.NET
36+
37+
38+
let cone =
39+
Chart.Cone(
40+
x = [1; 1; 1],
41+
y = [1; 2; 3],
42+
z = [1; 1; 1],
43+
u = [1; 2; 3],
44+
v = [1; 1; 2],
45+
w = [4; 4; 1]
46+
)
47+
48+
(*** condition: ipynb ***)
49+
#if IPYNB
50+
cone
51+
#endif // IPYNB
52+
53+
(***hide***)
54+
cone |> GenericChart.toChartHTML
55+
(*** include-it-raw ***)

docs/3_4_3d-streamtube-plots.fsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
(**
2+
---
3+
title: 3D streamtube plots
4+
category: 3D Charts
5+
categoryindex: 4
6+
index: 5
7+
---
8+
*)
9+
10+
(*** hide ***)
11+
12+
(*** condition: prepare ***)
13+
#r "nuget: Newtonsoft.JSON, 12.0.3"
14+
#r "nuget: DynamicObj"
15+
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"
16+
17+
(*** condition: ipynb ***)
18+
#if IPYNB
19+
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
20+
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
21+
#endif // IPYNB
22+
23+
(**
24+
# 3D Mesh plots
25+
26+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
27+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
28+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
29+
30+
*Summary:* This example shows how to create 3D-StreamTube charts in F#.
31+
32+
let's first create some data for the purpose of creating example charts:
33+
*)
34+
35+
#r "nuget: Deedle"
36+
#r "nuget: FSharp.Data"
37+
open Deedle
38+
open FSharp.Data
39+
open System
40+
open Plotly.NET
41+
42+
let tubeData =
43+
Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv"
44+
|> Frame.ReadCsvString
45+
46+
let streamTube =
47+
Chart.StreamTube(
48+
x = (tubeData.["x"] |> Series.values),
49+
y = (tubeData.["y"] |> Series.values),
50+
z = (tubeData.["z"] |> Series.values),
51+
u = (tubeData.["u"] |> Series.values),
52+
v = (tubeData.["v"] |> Series.values),
53+
w = (tubeData.["w"] |> Series.values),
54+
Starts =
55+
StreamTubeStarts.init(
56+
X = Array.init 16 (fun _ -> 80),
57+
Y = [20;30;40;50;20;30;40;50;20;30;40;50;20;30;40;50],
58+
Z = [0;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15]
59+
),
60+
ColorScale = StyleParam.Colorscale.Viridis
61+
)
62+
63+
64+
(*** condition: ipynb ***)
65+
#if IPYNB
66+
streamTube
67+
#endif // IPYNB
68+
69+
(***hide***)
70+
streamTube |> GenericChart.toChartHTML
71+
(*** include-it-raw ***)

0 commit comments

Comments
 (0)