Skip to content

Commit 381dc64

Browse files
authored
Merge pull request #184 from plotly/ternary
2 parents 4093086 + 3d032c6 commit 381dc64

File tree

67 files changed

+1020
-239
lines changed

Some content is hidden

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

67 files changed

+1020
-239
lines changed

.github/workflows/build-and-deploy-docs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: build and deploy docs
22

3-
on:
4-
push:
5-
branches: [ dev ]
3+
on: workflow_dispatch
64

75
jobs:
86
build-and-deploy-docs:
@@ -14,7 +12,7 @@ jobs:
1412
- name: Setup .NET
1513
uses: actions/setup-dotnet@v1
1614
with:
17-
dotnet-version: 5.0.100
15+
dotnet-version: '5.0.201'
1816
- name: Restore tools
1917
run: dotnet tool restore
2018
- name: Build docs

Plotly.NET.sln

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,68 @@ EndProject
3232
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".ci", ".ci", "{2461AFBF-6E10-4F7B-A0EA-3D62541C2EB1}"
3333
ProjectSection(SolutionItems) = preProject
3434
.github\workflows\build-and-deploy-docs.yml = .github\workflows\build-and-deploy-docs.yml
35-
.circleci\config.yml = .circleci\config.yml
35+
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
36+
.github\workflows\verify-docs.yml = .github\workflows\verify-docs.yml
3637
EndProjectSection
3738
EndProject
3839
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Plotly.NET.Interactive", "src\Plotly.NET.Interactive\Plotly.NET.Interactive.fsproj", "{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}"
3940
EndProject
4041
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{7B09CC0A-F1E1-4094-9DE4-B047581E01F0}"
4142
ProjectSection(SolutionItems) = preProject
43+
docs\00_0_basics.fsx = docs\00_0_basics.fsx
44+
docs\00_1_image-export.fsx = docs\00_1_image-export.fsx
45+
docs\00_2_display-options.fsx = docs\00_2_display-options.fsx
46+
docs\00_3_chart-config.fsx = docs\00_3_chart-config.fsx
47+
docs\01_0_axis-styling.fsx = docs\01_0_axis-styling.fsx
48+
docs\01_1_errorbars.fsx = docs\01_1_errorbars.fsx
49+
docs\01_2_multiple-charts.fsx = docs\01_2_multiple-charts.fsx
50+
docs\01_3_shapes.fsx = docs\01_3_shapes.fsx
51+
docs\01_4_annotations.fsx = docs\01_4_annotations.fsx
52+
docs\02_0_line-scatter-plots.fsx = docs\02_0_line-scatter-plots.fsx
53+
docs\02_1_bar-and-column-charts.fsx = docs\02_1_bar-and-column-charts.fsx
54+
docs\02_2_area-plots.fsx = docs\02_2_area-plots.fsx
55+
docs\02_3_range-plots.fsx = docs\02_3_range-plots.fsx
56+
docs\02_4_bubble-charts.fsx = docs\02_4_bubble-charts.fsx
57+
docs\02_5_pie-doughnut-charts.fsx = docs\02_5_pie-doughnut-charts.fsx
58+
docs\02_6_table.fsx = docs\02_6_table.fsx
59+
docs\02_7_heatmaps.fsx = docs\02_7_heatmaps.fsx
60+
docs\03_0_3d-scatter-plots.fsx = docs\03_0_3d-scatter-plots.fsx
61+
docs\03_1_3d-surface-plots.fsx = docs\03_1_3d-surface-plots.fsx
62+
docs\03_2_3d-mesh-plots.fsx = docs\03_2_3d-mesh-plots.fsx
63+
docs\03_3_3d-cone-charts.fsx = docs\03_3_3d-cone-charts.fsx
64+
docs\03_4_3d-streamtube-plots.fsx = docs\03_4_3d-streamtube-plots.fsx
65+
docs\03_5_3d-volume-plots.fsx = docs\03_5_3d-volume-plots.fsx
66+
docs\03_6_3d-isosurface-plots .fsx = docs\03_6_3d-isosurface-plots .fsx
67+
docs\04_0_histograms.fsx = docs\04_0_histograms.fsx
68+
docs\04_1_box-plots.fsx = docs\04_1_box-plots.fsx
69+
docs\04_2_violin-plots.fsx = docs\04_2_violin-plots.fsx
70+
docs\04_3_contour-plots.fsx = docs\04_3_contour-plots.fsx
71+
docs\04_4_2d-histograms.fsx = docs\04_4_2d-histograms.fsx
72+
docs\04_5_splom.fsx = docs\04_5_splom.fsx
73+
docs\05_0_geo-vs-mapbox.fsx = docs\05_0_geo-vs-mapbox.fsx
74+
docs\05_1_geo-plots.fsx = docs\05_1_geo-plots.fsx
75+
docs\05_2_choropleth-map.fsx = docs\05_2_choropleth-map.fsx
76+
docs\06_0_geo-vs-mapbox.fsx = docs\06_0_geo-vs-mapbox.fsx
77+
docs\06_1_mapbox-plots.fsx = docs\06_1_mapbox-plots.fsx
78+
docs\06_2_choropleth-mapbox.fsx = docs\06_2_choropleth-mapbox.fsx
79+
docs\06_3_density-mapbox.fsx = docs\06_3_density-mapbox.fsx
80+
docs\07_0_candlestick.fsx = docs\07_0_candlestick.fsx
81+
docs\07_1_funnel.fsx = docs\07_1_funnel.fsx
82+
docs\07_2_funnel_area.fsx = docs\07_2_funnel_area.fsx
83+
docs\08_0_polar_line-scatter-plots.fsx = docs\08_0_polar_line-scatter-plots.fsx
84+
docs\08_1_polar_bar_charts.fsx = docs\08_1_polar_bar_charts.fsx
85+
docs\08_2_styling_polar_layouts.fsx = docs\08_2_styling_polar_layouts.fsx
86+
docs\09_0_parallel-categories.fsx = docs\09_0_parallel-categories.fsx
87+
docs\09_1_parallel-coords.fsx = docs\09_1_parallel-coords.fsx
88+
docs\09_2_sankey.fsx = docs\09_2_sankey.fsx
89+
docs\10_0_ternary_line_scatter_plots.fsx = docs\10_0_ternary_line_scatter_plots.fsx
90+
docs\10_1_styling_ternary_layouts.fsx = docs\10_1_styling_ternary_layouts.fsx
91+
docs\_template.fsx = docs\_template.fsx
4292
docs\_template.html = docs\_template.html
93+
docs\_template.ipynb = docs\_template.ipynb
94+
docs\Dockerfile = docs\Dockerfile
4395
docs\index.fsx = docs\index.fsx
96+
docs\NuGet.config = docs\NuGet.config
4497
EndProjectSection
4598
EndProject
4699
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "reference", "reference", "{5219BAC7-ACE6-435F-A983-BC63DD7B745E}"
@@ -50,58 +103,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "reference", "reference", "{
50103
EndProject
51104
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{60FB82C0-F472-494E-BCF7-7B3C54212406}"
52105
ProjectSection(SolutionItems) = preProject
53-
docs\0_0_basics.fsx = docs\0_0_basics.fsx
54-
docs\0_1_image-export.fsx = docs\0_1_image-export.fsx
55-
docs\0_2_display-options.fsx = docs\0_2_display-options.fsx
56-
docs\0_3_chart-config.fsx = docs\0_3_chart-config.fsx
57-
docs\1_0_axis-styling.fsx = docs\1_0_axis-styling.fsx
58-
docs\1_1_errorbars.fsx = docs\1_1_errorbars.fsx
59-
docs\1_2_multiple-charts.fsx = docs\1_2_multiple-charts.fsx
60-
docs\1_3_shapes.fsx = docs\1_3_shapes.fsx
61-
docs\1_4_annotations.fsx = docs\1_4_annotations.fsx
62-
docs\2_0_line-scatter-plots.fsx = docs\2_0_line-scatter-plots.fsx
63-
docs\2_1_bar-and-column-charts.fsx = docs\2_1_bar-and-column-charts.fsx
64-
docs\2_2_area-plots.fsx = docs\2_2_area-plots.fsx
65-
docs\2_3_range-plots.fsx = docs\2_3_range-plots.fsx
66-
docs\2_4_bubble-charts.fsx = docs\2_4_bubble-charts.fsx
67-
docs\2_5_pie-doughnut-charts.fsx = docs\2_5_pie-doughnut-charts.fsx
68-
docs\2_6_table.fsx = docs\2_6_table.fsx
69-
docs\2_7_heatmaps.fsx = docs\2_7_heatmaps.fsx
70-
docs\3_0_3d-scatter-plots.fsx = docs\3_0_3d-scatter-plots.fsx
71-
docs\3_1_3d-surface-plots.fsx = docs\3_1_3d-surface-plots.fsx
72-
docs\3_2_3d-mesh-plots.fsx = docs\3_2_3d-mesh-plots.fsx
73-
docs\3_3_3d-cone-charts.fsx = docs\3_3_3d-cone-charts.fsx
74-
docs\3_4_3d-streamtube-plots.fsx = docs\3_4_3d-streamtube-plots.fsx
75-
docs\3_5_3d-volume-plots.fsx = docs\3_5_3d-volume-plots.fsx
76-
docs\3_6_3d-isosurface-plots .fsx = docs\3_6_3d-isosurface-plots .fsx
77-
docs\4_0_histograms.fsx = docs\4_0_histograms.fsx
78-
docs\4_1_box-plots.fsx = docs\4_1_box-plots.fsx
79-
docs\4_2_violin-plots.fsx = docs\4_2_violin-plots.fsx
80-
docs\4_3_contour-plots.fsx = docs\4_3_contour-plots.fsx
81-
docs\4_4_2d-histograms.fsx = docs\4_4_2d-histograms.fsx
82-
docs\4_5_splom.fsx = docs\4_5_splom.fsx
83-
docs\5_0_geo-vs-mapbox.fsx = docs\5_0_geo-vs-mapbox.fsx
84-
docs\5_1_geo-plots.fsx = docs\5_1_geo-plots.fsx
85-
docs\5_2_choropleth-map.fsx = docs\5_2_choropleth-map.fsx
86-
docs\6_0_geo-vs-mapbox.fsx = docs\6_0_geo-vs-mapbox.fsx
87-
docs\6_1_mapbox-plots.fsx = docs\6_1_mapbox-plots.fsx
88-
docs\6_2_choropleth-mapbox.fsx = docs\6_2_choropleth-mapbox.fsx
89-
docs\6_3_density-mapbox.fsx = docs\6_3_density-mapbox.fsx
90-
docs\7_0_candlestick.fsx = docs\7_0_candlestick.fsx
91-
docs\7_1_funnel.fsx = docs\7_1_funnel.fsx
92-
docs\7_2_funnel_area.fsx = docs\7_2_funnel_area.fsx
93-
docs\8_0_polar_line-scatter-plots.fsx = docs\8_0_polar_line-scatter-plots.fsx
94-
docs\8_1_polar_bar_charts.fsx = docs\8_1_polar_bar_charts.fsx
95-
docs\8_2_styling_polar_layouts.fsx = docs\8_2_styling_polar_layouts.fsx
96-
docs\9_0_parallel-categories.fsx = docs\9_0_parallel-categories.fsx
97-
docs\9_1_parallel-coords.fsx = docs\9_1_parallel-coords.fsx
98-
docs\9_2_sankey.fsx = docs\9_2_sankey.fsx
99-
docs\_template.html = docs\_template.html
100-
docs\_template.ipynb = docs\_template.ipynb
101-
docs\Dockerfile = docs\Dockerfile
102106
docs\content\fsdocs-custom.css = docs\content\fsdocs-custom.css
103-
docs\index.fsx = docs\index.fsx
104-
docs\NuGet.config = docs\NuGet.config
105107
EndProjectSection
106108
EndProject
107109
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "img", "img", "{CDB973F2-0F60-4ADB-84A8-924AFA8B6D49}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/5_0_geo-vs-mapbox.fsx renamed to docs/05_0_geo-vs-mapbox.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Plotly and therefore Plotly.NET supports two different kinds of maps:
3737
- **Geo maps** are outline-based maps. If your figure is created with a `Chart.ScatterGeo, `Chart.PointGeo`, `Chart.LineGeo` or `Chart.Choropleth` function or
3838
otherwise contains one or more traces of type `scattergeo` or `choropleth`, the layout.geo object in your figure contains configuration information for the map itself.
3939
40-
_This page documents Geo outline-based maps, and the [Mapbox Layers documentation]({{root}}/6_0_geo-vs-mapbox.html) describes how to configure Mapbox tile-based maps._
40+
_This page documents Geo outline-based maps, and the [Mapbox Layers documentation]({{root}}/06_0_geo-vs-mapbox.html) describes how to configure Mapbox tile-based maps._
4141
4242
## Physical Base Maps
4343
File renamed without changes.
File renamed without changes.

docs/6_0_geo-vs-mapbox.fsx renamed to docs/06_0_geo-vs-mapbox.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Plotly and therefore Plotly.NET supports two different kinds of maps:
3737
- **Geo maps** are outline-based maps. If your figure is created with a `Chart.ScatterGeo, `Chart.PointGeo`, `Chart.LineGeo` or `Chart.Choropleth` function or
3838
otherwise contains one or more traces of type `scattergeo` or `choropleth`, the layout.geo object in your figure contains configuration information for the map itself.
3939
40-
_This page documents Mapbox tile-based maps, and the [Geo map documentation]({{root}}/5_0_geo-vs-mapbox.html) describes how to configure outline-based maps_
40+
_This page documents Mapbox tile-based maps, and the [Geo map documentation]({{root}}/05_0_geo-vs-mapbox.html) describes how to configure outline-based maps_
4141
4242
## How Layers Work in Mapbox Tile Maps
4343
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
(**
2+
---
3+
title: Ternary line and scatter plots
4+
category: Ternary Plots
5+
categoryindex: 10
6+
index: 1
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+
# Ternary charts
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 ternary charts in F#.
31+
32+
let's first create some data for the purpose of creating example charts:
33+
34+
*)
35+
36+
open Plotly.NET
37+
38+
// a coordinates
39+
let a = [ 1; 2; 3; 4; 5; 6; 7;]
40+
41+
// b coordinates
42+
let b = a |> List.rev
43+
44+
//c
45+
let c = [ 2; 2; 2; 2; 2; 2; 2;]
46+
47+
48+
(**
49+
A Ternary plot is a barycentric plot on three variables which sum to a constant.
50+
51+
It graphically depicts the ratios of the three variables as positions in an equilateral triangle.
52+
53+
It is used in physical chemistry, petrology, mineralogy, metallurgy, and other physical sciences to show the compositions of systems composed of three species.
54+
In population genetics, a triangle plot of genotype frequencies is called a de Finetti diagram. In game theory, it is often called a simplex plot.
55+
56+
Ternary plots are tools for analyzing compositional data in the three-dimensional case.
57+
58+
## Ternary point charts
59+
60+
use `Chart.PointTernary` to create a ternary plot that displays points on a ternary coordinate system:
61+
*)
62+
63+
let ternaryPolar = Chart.PointTernary(a,b,c)
64+
(*** condition: ipynb ***)
65+
#if IPYNB
66+
ternaryPolar
67+
#endif // IPYNB
68+
69+
(***hide***)
70+
ternaryPolar |> GenericChart.toChartHTML
71+
(***include-it-raw***)
72+
73+
(**
74+
## Ternary line charts
75+
76+
use `Chart.LineTernary` to create a ternary plot that displays a line connecting input the data on a ternary coordinate system:
77+
78+
As values on ternary plots sum to a constant, you can omit one dimension ofd the data by providing that sum.
79+
80+
You can also for example change the line style using `Chart.withLineStyle`
81+
*)
82+
83+
let lineTernary =
84+
Chart.LineTernary(a,b,Sum = 10)
85+
|> Chart.withLineStyle(Color=Color.fromString "purple",Dash=StyleParam.DrawingStyle.DashDot)
86+
87+
(*** condition: ipynb ***)
88+
#if IPYNB
89+
lineTernary
90+
#endif // IPYNB
91+
92+
(***hide***)
93+
lineTernary |> GenericChart.toChartHTML
94+
(***include-it-raw***)

docs/10_1_styling_ternary_layouts.fsx

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
(**
2+
---
3+
title: Styling ternary layouts
4+
category: Ternary Plots
5+
categoryindex: 9
6+
index: 3
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+
# Styling ternary layouts
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 style polar layouts in F#.
31+
32+
let's first create some data for the purpose of creating example charts:
33+
*)
34+
open Plotly.NET
35+
36+
// a coordinates
37+
let a = [ 1; 2; 3; 4; 5; 6; 7;]
38+
39+
// b coordinates
40+
let b = a |> List.rev
41+
42+
//c
43+
let c = [ 2; 2; 2; 2; 2; 2; 2;]
44+
45+
(**
46+
Consider this combined ternary chart:
47+
*)
48+
49+
let combinedTernary =
50+
[
51+
Chart.PointTernary(a,b,c)
52+
Chart.LineTernary(a,c,Sum = 10)
53+
]
54+
55+
|> Chart.combine
56+
57+
(*** condition: ipynb ***)
58+
#if IPYNB
59+
combinedTernary
60+
#endif // IPYNB
61+
62+
(***hide***)
63+
combinedTernary |> GenericChart.toChartHTML
64+
(***include-it-raw***)
65+
66+
(**
67+
## Styling the polar layout
68+
69+
Use the `Chart.withTernary` function and initialize a Ternary layout with the desired looks
70+
*)
71+
open Plotly.NET.LayoutObjects
72+
73+
let styledTernary =
74+
combinedTernary
75+
|> Chart.withTernary(
76+
Ternary.init(
77+
AAxis = LinearAxis.init(Title = Title.init("A"), Color = Color.fromKeyword ColorKeyword.DarkOrchid),
78+
BAxis = LinearAxis.init(Title = Title.init("B"), Color = Color.fromKeyword ColorKeyword.DarkRed)
79+
)
80+
)
81+
82+
(*** condition: ipynb ***)
83+
#if IPYNB
84+
styledTernary
85+
#endif // IPYNB
86+
87+
(***hide***)
88+
styledTernary |> GenericChart.toChartHTML
89+
(***include-it-raw***)
90+
91+
(**
92+
## Styling A, B, and C Axes
93+
94+
You could pass these axes to `Chart.withTernary` as above, but for the case where you want to specifically set one axis, there are the `Chart.withAAxis`, `Chart.withBAxis`, `Chart.withCAxis` functions:
95+
*)
96+
97+
let styledTernary2 =
98+
styledTernary
99+
|> Chart.withCAxis(LinearAxis.init(Title = Title.init("C"), Color = Color.fromKeyword ColorKeyword.DarkCyan))
100+
101+
102+
103+
(*** condition: ipynb ***)
104+
#if IPYNB
105+
styledTernary2
106+
#endif // IPYNB
107+
108+
(***hide***)
109+
styledTernary2 |> GenericChart.toChartHTML
110+
(***include-it-raw***)

docs/index.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ One of the main design points of Plotly.NET it is to provide support for multipl
211211

212212
[(1,5);(2,10)]
213213
|> Chart.Point
214-
|> Chart.withTraceName("Hello from F#",Showlegend=true)
214+
|> Chart.withTraceName("Hello from F#",ShowLegend=true)
215215
|> Chart.withYAxisStyle("xAxis",ShowGrid= false, ShowLine=true)
216216
|> Chart.withXAxisStyle("yAxis",ShowGrid= false, ShowLine=true)
217217

0 commit comments

Comments
 (0)