// can't yet format YamlFrontmatter (["title: Styling ternary layouts"; "category: Ternary Plots"; "categoryindex: 11"; "index: 2"], Some { StartLine = 2 StartColumn = 0 EndLine = 6 EndColumn = 8 }) to pynb markdown

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

Styling ternary layouts

BinderScriptNotebook

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[ ]: