Powered by AppSignal & Oban Pro

Horizontal Error Bars

03_horizontal_error_bars.livemd

Horizontal Error Bars

Mix.install([
  {:plotly_ex, "~> 0.3"},
  {:kino, "~> 0.18"}
])

Section

error_x adds horizontal error bars. Both error_x and error_y can appear on the same trace.

alias Plotly.{Figure, Scatter}

Figure.new()
|> Figure.add_trace(
  Scatter.new(
    x: [1, 2, 3, 4],
    y: [2, 1, 3, 4],
    mode: "markers",
    error_x: %{type: "data", array: [0.2, 0.3, 0.1, 0.4], visible: true}
  )
)
|> Figure.update_layout(title: "Horizontal Error Bars")
|> Plotly.show()