Setting Graph Size in Fsharp

How to manipulate the graph size, margins and background color.


In [1]:
#r "nuget: Plotly.NET,  2.0.0-preview.8"
#r "nuget: Plotly.NET.Interactive,  2.0.0-preview.8"
Installed Packages
  • Plotly.NET, 2.0.0-preview.8
  • Plotly.NET.Interactive, 2.0.0-preview.8

Loading extensions from Plotly.NET.Interactive.dll

Added Kernel Extension including formatters for Plotly.NET charts.

Adjusting Height, Width, & Margins

In [2]:
open Plotly.NET 
open Plotly.NET.TraceObjects
open Plotly.NET.LayoutObjects

let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]

Chart.Point(x,y)            
            |> Chart.withSize(700.0,500.0)
            |> Chart.withMargin(Margin.init(?Left= Some(10.0) ))
Out[2]: