Skip to content

Commit 1bc6454

Browse files
committed
Docs for multiple charts
1 parent af4a5a8 commit 1bc6454

File tree

5 files changed

+45
-56
lines changed

5 files changed

+45
-56
lines changed

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 1.1.0 - Jan 14 2018
2+
* Add new charts
3+
* Add multiple axis support
4+
* Add subplot support
5+
6+
17
### 1.0.4 - Oct 17 2017
28
* Fixed nuget package
39

docs/content/errorbars.fsx

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,29 @@
55
#r "../../lib/FSharp.Care.dll"
66

77
(**
8-
Multiple charts and subcharts
8+
Error bars
99
=============================
1010
11-
How to create subplots in FSharp.Plotly. Find examples of combined, stacked, and plots with multiple axis.
11+
How to create plots in FSharp.Plotly and add error bars to it.
1212
1313
*)
1414

1515
#r "../../bin/FSharp.Plotly.dll"
1616
open FSharp.Plotly
1717

18+
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
19+
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
1820

19-
(**
20-
Functional F# scripting style for Two Y-Axes
21-
*)
22-
23-
[
24-
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
25-
|> Chart.withAxisAnchor(Y=1);
26-
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
27-
|> Chart.withAxisAnchor(Y=2);
28-
]
29-
|> Chart.Combine
30-
|> Chart.withY_AxisStyle("first",Side=StyleParam.Side.Left,Id=1)
31-
|> Chart.withY_AxisStyle("second",Side=StyleParam.Side.Right,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1)
32-
|> Chart.Show
33-
34-
35-
36-
(**
37-
Functional F# scripting style for Two Y-Axes same side
38-
*)
3921

40-
[
41-
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
42-
|> Chart.withAxisAnchor(Y=1);
43-
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
44-
|> Chart.withAxisAnchor(Y=2);
45-
]
46-
|> Chart.Combine
47-
|> Chart.withX_AxisStyle("x-axis",Domain=(0.3, 1.0))
48-
|> Chart.withY_AxisStyle("first y-axis")
49-
|> Chart.withY_AxisStyle("second y-axis",Side=StyleParam.Side.Left,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1,Position=0.15,Anchor=StyleParam.AxisAnchorId.Free)
50-
|> Chart.Show
5122

5223

24+
(*** define-output:pointsWithErrorBars ***)
25+
Chart.Point(x,y',Name="points with errors")
26+
|> Chart.withXErrorStyle (Array=[|0.2;0.3;0.2;0.1;0.2;0.4;0.2;0.08;0.2;0.1;|])
27+
|> Chart.withYErrorStyle (Array=[|0.3;0.2;0.1;0.4;0.2;0.4;0.1;0.18;0.02;0.2;|])
28+
(*** include-it:pointsWithErrorBars ***)
29+
//|> Chart.Show
5330

54-
// Simple Subplot
5531

5632

5733

docs/content/multiple-charts.fsx

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,54 @@ open FSharp.Plotly
2020
Functional F# scripting style for Two Y-Axes
2121
*)
2222

23+
(*** define-output:twoYaxes ***)
2324
[
24-
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
25-
|> Chart.withAxisAnchor(Y=1);
26-
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
27-
|> Chart.withAxisAnchor(Y=2);
25+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
26+
|> Chart.withAxisAnchor(Y=1);
27+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
28+
|> Chart.withAxisAnchor(Y=2);
2829
]
2930
|> Chart.Combine
3031
|> Chart.withY_AxisStyle("first",Side=StyleParam.Side.Left,Id=1)
3132
|> Chart.withY_AxisStyle("second",Side=StyleParam.Side.Right,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1)
32-
|> Chart.Show
33+
(*** include-it:twoYaxes ***)
34+
//|> Chart.Show
3335

3436

3537

3638
(**
3739
Functional F# scripting style for Two Y-Axes same side
3840
*)
3941

42+
(*** define-output:twoYaxesSide ***)
4043
[
41-
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
42-
|> Chart.withAxisAnchor(Y=1);
43-
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
44-
|> Chart.withAxisAnchor(Y=2);
44+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
45+
|> Chart.withAxisAnchor(Y=1);
46+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
47+
|> Chart.withAxisAnchor(Y=2);
4548
]
4649
|> Chart.Combine
4750
|> Chart.withX_AxisStyle("x-axis",Domain=(0.3, 1.0))
4851
|> Chart.withY_AxisStyle("first y-axis")
4952
|> Chart.withY_AxisStyle("second y-axis",Side=StyleParam.Side.Left,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1,Position=0.15,Anchor=StyleParam.AxisAnchorId.Free)
50-
|> Chart.Show
51-
52-
53+
(*** include-it:twoYaxesSide ***)
54+
//|> Chart.Show
5355

54-
// Simple Subplot
55-
[for i=1 to 8 do yield (Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers) |> Chart.withY_AxisStyle("y-title") )]
5656

57-
|> Chart.stackHorizontal(Col=2,Space=0.15)
58-
|> Chart.Combine
59-
|> Chart.Show
57+
(**
58+
Functional F# scripting style simple subplot stacked 2 columns.
59+
Axis style (like: title) is taken from the single chart, but can also be styled by axis id.
60+
*)
6061

61-
//|> Chart.withX_AxisStyle("Title1")
62-
//|> Chart.withX_AxisStyle(sprintf "Title%i" 3,Id=3)
62+
(*** define-output:stack ***)
63+
[
64+
for i=1 to 8 do
65+
yield Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers)
66+
|> Chart.withY_AxisStyle(sprintf "y-title %i" i)
67+
]
68+
|> Chart.Stack(Columns=2,Space=0.15)
69+
|> Chart.withX_AxisStyle(sprintf "x-title %i" 3,Id=3)
70+
(*** include-it:stack ***)
6371
//|> Chart.Show
6472

6573

src/FSharp.Plotly/ChartExtensions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ module ChartExtensions =
309309

310310

311311
/// Create a combined chart with the given charts merged
312-
static member Stack (?ColCount:int, ?Space) =
312+
static member Stack (?Columns:int, ?Space) =
313313
(fun (charts:#seq<GenericChart>) ->
314314

315-
let col = defaultArg ColCount 2
315+
let col = defaultArg Columns 2
316316
let len = charts |> Seq.length
317317
let colWidth = 1. / float col
318318
let rowWidth =

temp/gh-pages

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)