Visitar URL original
Displaying figures in Fsharp

Displaying Figures in F#

Displaying Figures using Plotly's F# graphing library


Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.

Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.

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)