# `Visualize.Layout.Hexbin`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/layout/hexbin.ex#L1)

Hexagonal binning of points in the plane (spec/06 §9, #348): d3-hexbin's lattice of
flat-topped hexagons, the columns `2 r sin(π/3)` apart and the rows `1.5 r`, every odd
row offset by half a column. The lattice is in the coordinates of the points, so a chart
bins pixels.

## Examples

    iex> [cell] = Visualize.Layout.Hexbin.bin([{1, 1}, {-1, 2}], 20)
    iex> {cell.x, cell.y, cell.count}
    {0.0, 0.0, 2}

# `cell`

```elixir
@type cell() :: %{
  x: float(),
  y: float(),
  count: pos_integer(),
  points: [{number(), number()}]
}
```

A non-empty cell: its center, its count and its points in input order.

# `bin`

```elixir
@spec bin([{number(), number()}], number()) :: [cell()]
```

The non-empty cells of the lattice over `points`, in lattice order (row, then column).

# `hexagon`

```elixir
@spec hexagon(number(), number(), number()) :: Visualize.IR.Path.t()
```

The closed flat-topped hexagon of `radius` at the center, its first vertex at bearing
−30° (the upper right), then clockwise on screen.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
