Bland.Grid (Elixir Technical Drawing v0.5.0)

Copy Markdown View Source

Composes multiple %Bland.Figure{} into one SVG — the multi-panel layout tool.

Two-panel subplot

Bland.grid/2 renders each figure at its native viewBox and places the result inside a nested <svg> at the appropriate cell, so every panel renders independently and keeps its own ticks, labels, ornaments.

This is a render-time operation — it does not mutate figures. Pass it a list of fully-built figures and it produces an SVG binary.

fig1 = Bland.figure(title: "Panel A") |> Bland.line(xs, ys1)
fig2 = Bland.figure(title: "Panel B") |> Bland.line(xs, ys2)

svg = Bland.grid([fig1, fig2], columns: 2)
File.write!("paired.svg", svg)

Options

  • :columns — number of columns (default fills one row)
  • :rows — number of rows (default derived from count)
  • :cell_width — pixel width each cell is rendered at. Defaults to the first figure's native width.
  • :cell_height — same for height
  • :gap — pixel gap between cells (default 16)
  • :padding — pixel padding around the outer edge (default 20)
  • :title — optional outer title drawn above the panels
  • :background — outer background color (default "white")

Summary

Functions

Composes figures into a single SVG string. See module doc for options.

Functions

render(figures, opts \\ [])

@spec render(
  [Bland.Figure.t()],
  keyword()
) :: String.t()

Composes figures into a single SVG string. See module doc for options.