In [ ]:
#r "nuget: Plotly.NET, 2.0.0"
#r "nuget: Plotly.NET.Interactive, 2.0.0"


# Styling ternary layouts¶

Summary: This example shows how to style polar layouts in F#.

let's first create some data for the purpose of creating example charts:

In [3]:
open Plotly.NET

// a coordinates
let a  = [ 1; 2; 3; 4; 5; 6; 7;]

// b coordinates
let b  = a |> List.rev

//c
let c  = [ 2; 2; 2; 2; 2; 2; 2;]


Consider this combined ternary chart:

In [4]:
let combinedTernary =
[
Chart.PointTernary(a,b,c)
Chart.LineTernary(a,c,Sum = 10)
]

|> Chart.combine

In [ ]:
combinedTernary

Out[ ]:

## Styling the polar layout¶

Use the Chart.withTernary function and initialize a Ternary layout with the desired looks

In [6]:
open Plotly.NET.LayoutObjects

let styledTernary =
combinedTernary
|> Chart.withTernary(
Ternary.init(
AAxis = LinearAxis.init(Title = Title.init("A"), Color = Color.fromKeyword ColorKeyword.DarkOrchid),
BAxis = LinearAxis.init(Title = Title.init("B"), Color = Color.fromKeyword ColorKeyword.DarkRed)
)
)

In [ ]:
styledTernary

Out[ ]:

## Styling A, B, and C Axes¶

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:

In [8]:
let styledTernary2 =
styledTernary
|> Chart.withCAxis(LinearAxis.init(Title = Title.init("C"), Color = Color.fromKeyword ColorKeyword.DarkCyan))


In [ ]:
styledTernary2

Out[ ]: