Skip to content

Commit 1d2938d

Browse files
committed
Add subplot title docs
1 parent ded1e9f commit 1d2938d

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

docs/chart-layout/multiple-charts.fsx

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ grid3 |> GenericChart.toChartHTML
164164
(***include-it-raw***)
165165

166166
(**
167+
168+
#### Coupled axes
169+
167170
Use `Pattern=StyleParam.LayoutGridPatter.Coupled` to use one shared x axis per column and one shared y axis per row.
168171
(Try zooming in the single subplots below)
169172
*)
@@ -192,6 +195,37 @@ grid4
192195
grid4 |> GenericChart.toChartHTML
193196
(***include-it-raw***)
194197

198+
(**
199+
200+
#### Individual subplot titles
201+
202+
You can set individual subplot titles by using the `SubPlotTitles` argument of the `Chart.Grid` function:
203+
*)
204+
205+
let grid5 =
206+
[ Chart.Point(x = x, y = y, Name = "1,1")
207+
|> Chart.withXAxisStyle "x1"
208+
|> Chart.withYAxisStyle "y1"
209+
Chart.Line(x = x, y = y, Name = "1,2")
210+
|> Chart.withXAxisStyle "x2"
211+
|> Chart.withYAxisStyle "y2"
212+
Chart.Spline(x = x, y = y, Name = "2,1")
213+
|> Chart.withXAxisStyle "x3"
214+
|> Chart.withYAxisStyle "y3"
215+
Chart.Point(x = x, y = y, Name = "2,2")
216+
|> Chart.withXAxisStyle "x4"
217+
|> Chart.withYAxisStyle "y4" ]
218+
|> Chart.Grid(2, 2, SubPlotTitles = [ "First"; "Second"; "Third"; "Fourth" ])
219+
220+
(*** condition: ipynb ***)
221+
#if IPYNB
222+
grid5
223+
#endif // IPYNB
224+
225+
(***hide***)
226+
grid5 |> GenericChart.toChartHTML
227+
(***include-it-raw***)
228+
195229
(**
196230
### Chart.SingleStack
197231
@@ -311,8 +345,23 @@ let multipleTraceTypesGrid =
311345
Chart.BoxPlot(X = "y", Y = y, Name = "Combined 1", Jitter = 0.1, BoxPoints = StyleParam.BoxPoints.All)
312346
Chart.BoxPlot(X = "y'", Y = y, Name = "Combined 2", Jitter = 0.1, BoxPoints = StyleParam.BoxPoints.All) ]
313347
|> Chart.combine ]
314-
|> Chart.Grid(nRows = 4, nCols = 3)
315-
|> Chart.withSize (Width = 1000, Height = 1000)
348+
|> Chart.Grid(
349+
nRows = 4,
350+
nCols = 3,
351+
SubPlotTitles = [
352+
"2D Cartesian"
353+
"3D Cartesian"
354+
"Polar"
355+
"Geo"
356+
"MapBox"
357+
"Ternary"
358+
"Carpet"
359+
"Pie"
360+
"BubbleSmith"
361+
"Combined 1"
362+
]
363+
)
364+
|> Chart.withSize (Width = 1000, Height = 1500)
316365

317366
(*** condition: ipynb ***)
318367
#if IPYNB
@@ -327,7 +376,7 @@ multipleTraceTypesGrid |> GenericChart.toChartHTML
327376
If you are not sure if trace types are compatible, look at the `TraceIDs`:
328377
*)
329378

330-
let pointType = Chart.Point(xy = [ 1, 2 ]) |> GenericChart.getTraceID
379+
Chart.Point(xy = [ 1, 2 ]) |> GenericChart.getTraceID
331380
(***include-it***)
332381

333382
[ Chart.Point(xy = [ 1, 2 ]); Chart.PointTernary(abc = [ 1, 2, 3 ]) ]

0 commit comments

Comments
 (0)