Plotly.NET icon indicating copy to clipboard operation
Plotly.NET copied to clipboard

'NaN' disturbs axis format

Open caroott opened this issue 4 years ago • 0 comments

Description

When i want to create Boxplots of float arrays and combine them, i run into an issue if one or more of the arrays consist of 'NaN'. With the NaNs in the array the axis seems to be treated as a category axis and not as a value axis, leading to a non-continuously labeled axis.

image

Repro steps

  1. Open a fsx file and load FShar.Plotly

  2. Run the following snippet:

let testArr =
    [|
        (1, [|nan;nan;nan|]);
        (2, [|0.07427533383; 0.757004965; 0.6258709596|]);
        (3, [|0.2661355688; 0.7138485368; 0.3500703892|])
    |]

testArr
|> Array.map (fun (number, values) ->
    Chart.BoxPlot ("y",values, Name=(sprintf "N: %i" number),Boxpoints=StyleParam.Boxpoints.All,Orientation=StyleParam.Orientation.Vertical)
)
|> Chart.Combine
|> Chart.withMargin (Margin.init(Left=200.))
|> Chart.Show

Known workarounds

Filter all arrays and remove every NaN present

caroott avatar Jul 09 '20 16:07 caroott