|
| 1 | +(*** hide ***) |
| 2 | +// This block of code is omitted in the generated HTML documentation. Use |
| 3 | +// it to define helpers that you do not want to show in the documentation. |
| 4 | +#r "../../bin/Newtonsoft.Json.dll" |
| 5 | +#r "../../lib/FSharp.Care.dll" |
| 6 | + |
| 7 | +(** |
| 8 | +Multiple charts and subcharts |
| 9 | +============================= |
| 10 | +
|
| 11 | +How to create subplots in FSharp.Plotly. Find examples of combined, stacked, and plots with multiple axis. |
| 12 | +
|
| 13 | +*) |
| 14 | + |
| 15 | +#r "../../bin/FSharp.Plotly.dll" |
| 16 | +open FSharp.Plotly |
| 17 | + |
| 18 | + |
| 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 | +*) |
| 39 | + |
| 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 |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +// Simple Subplot |
| 55 | + |
0 commit comments