Macaw.Frame.Coordinates.Polar (macaw_frame v0.1.0)

Copy Markdown View Source

The polar model (spec/03 §7): angle and r as position scales, color and any other declared scale. Its grid, layers and polar axes sit in a group translated to the plot's center; R = min(w, h) / 2 is the outer radius.

  • The angle (§7.2): angle's range is a sweep from a start, [start, start + sweep] in radians clockwise from 12 o'clock (start: 0, sweep: 360 degrees); a zero or over-full sweep is {:sweep, value}. A categorical angle widens its range by half a step at each end so band centers span the sweep.
  • Furniture (§7.3): an axis on angle is an arc at its radius (a circle on a full turn) with ticks outward and spokes as its grid; on r a spoke by side or at with ticks across and arcs as its grid; every coordinate rounded to six decimals with negative zero folded; a zero-radius ring not drawn.
  • The bend (§7.4, bend/2): a layer laid out as in cartesian (x through angle, y through r) is bent about the center; over a categorical angle straight segments are chords. Polar-native kinds and paths are not bent (their kind declares it).
  • The ring rule (§7.5): an r range of :ring (or %{ring: inner}) resolves to [inner, min(w, h) / 2 − (4 + dr + t + 4)] for the frame's outward labels, an inner under 1 a share of that outer radius.
  • Hit-testing, writes and summary (§7.6): invert/2 from atan2 and the distance from the center; a pick writes selection, never window; its group's .item key.

Copied from visualize's Visualize.Chart.Frame (:polar), its polar furniture and Visualize.Chart.Mark.Bend.