jupyter
jupytext
kernelspec
language_info
plotly
text_representation
extension
format_name
format_version
jupytext_version
.md
markdown
1.3
1.12.0
display_name
language
name
.NET (F#)
F#
.net-fsharp
codemirror_mode
file_extension
mimetype
name
nbconvert_exporter
pygments_lexer
version
.fs
text/x-fsharp
F#
fsharp
fsharp
5.0
description
display_as
language
layout
name
order
page_type
permalink
thumbnail
How to create charts from csv files with Plotly and F#
advanced_opt
fsharp
base
Plot CSV Data
1
example_index
fsharp/plot-data-from-csv/
thumbnail/csv.jpg
#r " nuget: Plotly.NET, 2.0.0-preview.8"
#r " nuget: Plotly.NET.Interactive, 2.0.0-preview.8"
#r " nuget: FSharp.Data"
#r " nuget:Deedle"
Plot from CSV with Plotly
open FSharp.Data
open Deedle
open Plotly.NET
open Plotly.NET .LayoutObjects
let dataset =
Http.RequestString " https://raw.githubusercontent.com/plotly/datasets/master/2014_apple_stock.csv"
|> fun csv -> Frame.ReadCsvString( csv, true , separators= " ," )
let getColumn column =
dataset
|> Frame.getCol column
|> Series.values
let xy = Seq.zip ( getColumn " AAPL_x" :> seq< DateTime>) ( getColumn " AAPL_y" :> seq< float>)
Chart.Line( xy, Name= " Share Prices (in USD)" )
|> Chart.withLayout( Layout.init( Title.init( " Apple Share Prices over time (2014)" ), PlotBGColor= Color.fromString " #e5ecf6" , ShowLegend= true , Width= 1100 ))
|> Chart.withXAxis( LinearAxis.init( Title= Title.init( " AAPL_x" ), ZeroLineColor= Color.fromString" #ffff" , ZeroLineWidth= 2. , GridColor= Color.fromString" #ffff" ))
|> Chart.withYAxis( LinearAxis.init( Title= Title.init( " AAPL_y" ), ZeroLineColor= Color.fromString" #ffff" , ZeroLineWidth= 2. , GridColor= Color.fromString" #ffff" ))