# `Macaw.Draw.Shape.Rose`
[🔗](https://github.com/dcoai/macaw_draw/blob/v0.1.0/lib/macaw/draw/shape/rose.ex#L1)

One sector per datum about its angle (spec/07 §15), copied from visualize's
`Visualize.Shape.Rose`: a wind rose, a compass rose, an hour-of-day clock.

`angle/2` and `width/2` are in the domain units of the radial scale given to `scale/2`
(radians without one): the sector runs from `apply(scale, angle − width/2)` to
`apply(scale, angle + width/2)`. Over a `Macaw.Draw.Scale.Band` the angle is a category
and the sector its band, from the band's start through `bandwidth/1`, and `width` is not
read. The radii are pixel accessors; `pad_angle/2` is `Macaw.Draw.Shape.Arc`'s.

    iex> alias Macaw.Draw.Shape.Rose
    iex> Rose.span(nil, 1.0, 0.5)
    {0.75, 1.25}

`generate_path/2` answers one path per datum in data order, `Macaw.Draw.Shape.Arc`'s
path for that datum's radii, span and pad; a datum with no span draws the empty path, so
the list stays one path a datum.

# `accessor`

```elixir
@type accessor() :: (term() -&gt; term()) | atom() | String.t() | number()
```

# `error`

```elixir
@type error() :: {:error, [Macaw.Base.Fault.t()]}
```

A refusal: faults with their paths.

# `t`

```elixir
@type t() :: %Macaw.Draw.Shape.Rose{
  angle: (term() -&gt; term()) | nil,
  inner_radius: (term() -&gt; term()) | number(),
  outer_radius: (term() -&gt; term()) | nil,
  pad_angle: (term() -&gt; term()) | number(),
  scale: struct() | nil,
  width: (term() -&gt; term()) | number()
}
```

# `angle`

```elixir
@spec angle(t(), accessor()) :: t() | error()
```

Sets the sector center, in the scale's domain units, accessor: a function, a field, or a number.

# `generate`

```elixir
@spec generate(t(), [term()]) :: [String.t()] | error()
```

One SVG path data string per datum.

# `generate_path`

```elixir
@spec generate_path(t(), [term()]) :: [Macaw.Draw.IR.Path.t()] | error()
```

One `Macaw.Draw.IR.Path` per datum, the empty path for a datum with no span.

# `inner_radius`

```elixir
@spec inner_radius(t(), accessor()) :: t() | error()
```

Sets the inner radius, in pixels, accessor: a function, a field, or a number.

# `new`

```elixir
@spec new() :: t()
```

A rose reading tuple elements 0 and 1 as angle and outer radius, width 1.

# `outer_radius`

```elixir
@spec outer_radius(t(), accessor()) :: t() | error()
```

Sets the outer radius, in pixels, accessor: a function, a field, or a number.

# `pad_angle`

```elixir
@spec pad_angle(t(), accessor()) :: t() | error()
```

Sets the pad angle, in radians, accessor: a function, a field, or a number.

# `scale`

```elixir
@spec scale(t(), struct() | nil) :: t() | error()
```

Sets the radial scale the angles map through; `nil` means radians.

# `span`

```elixir
@spec span(struct() | nil, term(), term()) :: {number(), number()} | nil
```

A sector's sweep, `{start, end}` in radians, or `nil` when the datum does not place: a
category off a band scale's domain, an angle or width that is not a number over any
other scale, or a scale that answers something other than a number.

# `width`

```elixir
@spec width(t(), accessor()) :: t() | error()
```

Sets the sector width, in the scale's domain units, accessor: a function, a field, or a number.

---

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