View Source Changelog

v0.3.0 (2024-01-03)

Added

  • Nx support, you can pass directly tensors as data series.
x = Nx.linspace(-20, 20, n: 200)
y = Nx.pow(x, 2)

Tucan.lineplot([x: x, y: y], "x", "y", width: 400)
image = Nx.tensor([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], type: {:f, 32})

Tucan.imshow(image, show_scale: true, width: 200, height: 150)
Tucan.errorbar(:barley, "yield", group_by: "variety", points: true, ticks: true)
|> Tucan.color_by("variety")
Tucan.errorband(:cars, "Year", "Miles_per_Gallon",
  extent: :ci,
  fill_color: "black",
  borders: true,
  x: [time_unit: "year", type: :temporal]
)
data = [
  category: ["A", "B", "C", "D"],
  value: [90, 72, 81, 50, 64]
]

Tucan.lollipop(data, "category", "value",
  orient: :horizontal,
  point_color: "red",
  width: 300
)
|> Tucan.Scale.set_x_domain(30, 100)
Tucan.layers([
  Tucan.Geometry.rectangle({-2, 10}, {7, -3}, line_color: "green"),
  Tucan.Geometry.rectangle({-3.5, 0.1}, {8.1, -4.2},
    fill_color: "pink",
    fill_opacity: 0.3
  ),
  Tucan.Geometry.polyline([{1, 1}, {2, 7}, {5, 3}],
    closed: true,
    fill_color: "green",
    fill_opacity: 0.3
  )
])
|> Tucan.Scale.set_xy_domain(-5, 11)
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.Axes.set_orientation(:y, :right)

Added plot options

  • Support :point_shape, :point_size and :point_color in Tucan.stripplot/3.
  • Support uniform jittering through :jitter_mode in Tucan.Stripplot/3.
  • Support stacked mode in Tucan.density/3.

Changed

Deprecated

v0.2.1 (2023-10-17)

Added

  • Support conditional text color in heatmaps using the :text_color option.
Tucan.heatmap(:glue, "Task", "Model", "Score",
  annotate: true,
  text: [format: ".1f"],
  text_color: [{nil, 40, "black"}, {40, 80, "white"}, {60, nil, "yellow"}]
)
|> Tucan.set_size(250, 250)
Tucan.new()
|> Tucan.annotate(10, 10, "Hello", color: :red, font_size: 20)
|> Tucan.annotate(15, 12, "world...", color: :green, font_weight: :bold)
|> Tucan.Scale.set_xy_domain(8, 17)
Tucan.new()
|> Tucan.circle({3, 2}, 5, line_color: "purple")
|> Tucan.circle({-1, 6}, 2, line_color: "red")
|> Tucan.circle({0, 1}, 4, line_color: "green", stroke_width: 3)
|> Tucan.Scale.set_xy_domain(-4, 8)

Added plot options

v0.2.0 (2023-09-23)

Added

Tucan.jointplot(
  :penguins,
  "Beak Length (mm)",
  "Beak Depth (mm)",
  marginal: :density,
  color_by: "Species",
  marginal_opts: [fill_opacity: 0.5]
)
  • Add Tucan.punchcard/5 plot. This is similar to heatmap but the third dimension is encoded by size instead of color.
Tucan.punchcard(:glue, "Task", "Model", "Score")
|> Tucan.color_by("Score", recursive: true, type: :quantitative)
|> Tucan.set_size(250, 250)
Tucan.heatmap(:glue, "Task", "Model", "Score", annotate: true, text: [format: ".1f"])
|> Tucan.set_size(250, 250)
Tucan.scatter(:iris, "petal_width", "petal_length", width: 300)
|> Tucan.hruler(3, line_color: "green")
|> Tucan.vruler("petal_width", color_by: "species", stroke_width: 3)
|> Tucan.hruler("petal_length", color_by: "species")
Tucan.layers([
  Tucan.scatter(:iris, "petal_width", "petal_length", point_color: "red"),
  Tucan.scatter(:iris, "sepal_width", "sepal_length", point_color: "green")
])

Added plots options

Fixed

  • Support setting :orient in Tucan.density/3.
  • Make size encodings quantitative by default.

Deprecated

v0.1.1 (2023-08-29)

Added

  • Add concat/2, hconcat/2 and vconcat/2 helper concatenation functions.

v0.1.0 (2023-08-28)

Initial release.