Issue
I was able to generate a chart from F# interactive. However, the chart shows in the browser. I would like to see it show in an output cell. Is that possible?
I am using the Polyglot notebook extension.
I was able to generate a chart from F# interactive using this code:
#r "nuget: XPlot.Plotly"
#r "nuget: XPlot.Plotly.Interactive"
open XPlot.Plotly
let z = 3
let x = [1; 2; 3; 4; 5]
let y = [1; 4; 9; 16; 25]
printfn $"z = {z}"
let scatter = Scattergl(x = x, y = y, mode = "markers")
Chart.Plot([scatter])
|> Chart.WithTitle("Scatter Plot")
|> Chart.WithXTitle("X-Axis")
|> Chart.WithYTitle("Y-Axis")
|> Chart.Show
Solution
Change the cell to return the final chart, rather than call Chart.Show
. This can be done by simply removing the final line:
Chart.Plot([scatter])
|> Chart.WithTitle("Scatter Plot")
|> Chart.WithXTitle("X-Axis")
|> Chart.WithYTitle("Y-Axis")
In VS Code, I've confirmed that this displays the chart in the notebook:
Answered By - Brian Berns
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.