#r "nuget: Plotly.NET, 5.0.0"
#r "nuget: Plotly.NET.Interactive, 5.0.0"
Premade templates can be accessed via the ChartTemplates
module. In fact, the ChartTemplates.plotly
template is always active by default (see global defaults)
open Plotly.NET
let lightMirrored =
Chart.Point(xy = [ 1, 2 ]) |> Chart.withTemplate ChartTemplates.lightMirrored
lightMirrored
Here are the contents of the template plotly
which is used by default for all charts: https://github.com/plotly/Plotly.NET/blob/6e28decca64441320d8cffab5bcfee664b118c36/src/Plotly.NET/Templates/ChartTemplates.fs#L163-L665
Chart Templates consist of a Layout
object and a collection of Trace
objects. Both are used to set default values for all possible styling options:
open Plotly.NET.TraceObjects
let layoutTemplate =
Layout.init (Title = Title.init ("I will always be there now!"))
let traceTemplates =
[ Trace2D.initScatter (
Trace2DStyle.Scatter(Marker = Marker.init (Symbol = StyleParam.MarkerSymbol.ArrowLeft, Size = 20))
) ]
let myTemplate = Template.init (layoutTemplate, traceTemplates)
let myTemplateExampleChart =
Chart.Point(xy = [ 1, 2 ]) |> Chart.withTemplate myTemplate
myTemplateExampleChart