Skip to content

Error bar with Type "Constant" is not working as expected #221

@MaheshPunna

Description

@MaheshPunna
open Plotly.NET
open System

let x_theo = [-4. .. 0.08 ..4.]
let sincx = [for x in x_theo -> Math.Sin(Math.PI*x)/(Math.PI*x)]

let x = [-3.8; -3.03; -1.91; -1.46; -0.89; -0.24; -0.0; 0.41; 0.89; 1.01; 1.91; 2.28; 2.79; 3.56]
let y = [-0.02; 0.04; -0.01; -0.27; 0.36; 0.75; 1.03; 0.65; 0.28; 0.02; -0.11; 0.16; 0.04; -0.15]

[ Chart.Scatter(x = x_theo, y = sincx, mode = StyleParam.Mode.Lines, Name = "sinc(x)")

  Chart.Scatter(x = x, y = y, mode = StyleParam.Mode.Markers, Name = "measured")
  |> Chart.withYError (
      Error.init (
          Type = StyleParam.ErrorType.Constant,
          Value = 0.1,
          Color = Color.fromString "purple",
          Thickness = 1.5,
          Width = 3.
      )
  )
  |> Chart.withXError (
      Error.init (
          Type = StyleParam.ErrorType.Constant,
          Value = 0.2,
          Color = Color.fromString "purple",
          Thickness = 1.5,
          Width = 3.
      )
  )
  |> Chart.withMarkerStyle (Size = 8, Color = Color.fromString "purple") ]
|> Chart.combine

Current Behavior:

image

Expected Behavior:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions