# `Visualize.Shape.Rose`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/shape/rose.ex#L1)

Rose generator: one `Visualize.Shape.Arc` sector per datum, centered on its angle and
as long as its value (spec/04 §15, D-31).

`angle/2` and `width/2` are in the domain units of the radial scale given to `scale/2`
(radians without one); the radii are pixels. Each datum's path is exactly the `Arc`
call with the same numbers, so a stacked wind rose is several roses with rising inner
radii.

## Examples

    bearing = Visualize.Scale.radial() |> Visualize.Scale.domain([0, 360])
    radius = Visualize.Scale.sqrt() |> Visualize.Scale.domain([0, 40]) |> Visualize.Scale.range([0, 120])

    rose =
      Visualize.Shape.Rose.new()
      |> Visualize.Shape.Rose.scale(bearing)
      |> Visualize.Shape.Rose.angle(:bearing)
      |> Visualize.Shape.Rose.width(45)
      |> Visualize.Shape.Rose.outer_radius(fn d -> Visualize.Scale.apply(radius, d.count) end)
      |> Visualize.Shape.Rose.pad_angle(0.02)

    paths = Visualize.Shape.Rose.generate(rose, bins)

# `accessor`

```elixir
@type accessor() :: Visualize.Shape.Line.accessor()
```

# `t`

```elixir
@type t() :: %Visualize.Shape.Rose{
  angle: accessor() | nil,
  inner_radius: accessor(),
  outer_radius: accessor() | nil,
  pad_angle: accessor(),
  scale: struct() | nil,
  width: accessor()
}
```

# `angle`

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

Sets the sector-center accessor, in the scale's domain units

# `generate`

```elixir
@spec generate(t(), Visualize.Data.Table.source()) :: [String.t()]
```

Returns one SVG path-data string per datum

# `generate_path`

```elixir
@spec generate_path(t(), Visualize.Data.Table.source()) :: [Visualize.IR.Path.t()]
```

Returns one `IR.Path` per datum: the `Arc` sector centered on its angle

# `inner_radius`

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

Sets the inner radius accessor, in pixels

# `new`

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

Creates a rose generator reading tuple elements 0 and 1 as angle and outer radius

# `outer_radius`

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

Sets the outer radius accessor, in pixels

# `pad_angle`

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

Sets the pad angle accessor, radians, as `Visualize.Shape.Arc.pad_angle/2`

# `scale`

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

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

# `width`

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

Sets the sector-width accessor, in the scale's domain units

---

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