Displaying Figures in Fsharp

Displaying Figures using Plotly's F# graphing library


In [1]:
#r "nuget: Plotly.NET, 2.0.0-preview.8"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.8"
open Plotly.NET
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.

Displaying Figures

In [2]:
let x = [for i in 1..3 -> i]
let y=[for i in 1..3 -> i]
Chart.Column(x,y)
        |>Chart.withTitle("A Figure Displaying Itself")
Out[2]:

Overriding The Default Renderer

In [3]:
let x = [for i in 1..3 -> i]
let y=[for i in 1..3 -> i]
Chart.Column(x,y,Name="SVG")
        |>Chart.withTitle("A Figure Displayed with the 'svg' Renderer")
        //|> Chart.withMarker (Marker.init (Color="Blues"))
        |>Chart.showAsImage(StyleParam.ImageFormat.SVG)

Static Image Renderers

In [4]:
let x = [for i in 1..3 -> i]
let y=[for i in 1..3 -> i]
Chart.Column(x,y,Name="SVG")
        |>Chart.withTitle("A Figure Displayed with the 'png' Renderer")
        |> Chart.withSize(800.,300.)
        |>Chart.showAsImage(StyleParam.ImageFormat.PNG)
In [5]:
let x = [for i in 1..3 -> i]
let y=[for i in 1..3 -> i]
Chart.Column(x,y,Name="SVG")
        |>Chart.withTitle("A Figure Displayed with the 'jpeg' Renderer")
        |> Chart.withSize(800.,300.)
        |>Chart.showAsImage(StyleParam.ImageFormat.JPEG)