Powered by AppSignal & Oban Pro

Add Marker Border

41_add_marker_border.livemd

Add Marker Border

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

Section

marker.line adds a border (outline) around each marker. Set color for the border colour and width for its thickness in pixels.

alias Plotly.{Figure, Scatter}

Figure.new()
|> Figure.add_trace(Scatter.new(
  x: [1, 2, 3, 4, 5, 6, 7],
  y: [3, 1, 4, 1, 5, 9, 2],
  mode: "markers",
  name: "With border",
  marker: %{
    size: 18,
    color: "steelblue",
    line: %{color: "darkblue", width: 3}
  }
))
|> Figure.add_trace(Scatter.new(
  x: [1, 2, 3, 4, 5, 6, 7],
  y: [2, 7, 1, 8, 2, 8, 4],
  mode: "markers",
  name: "No border",
  marker: %{size: 18, color: "tomato"}
))
|> Figure.update_layout(title: "Marker Border vs No Border")
|> Plotly.show()