Computes radial positions for stacked dot plots on circular plots.
Observations at the same angle (or within tol radians of each other)
are assigned successive radial positions, preventing overplotting of
coincident or binned headings.
Usage
stack_headings(
data,
col = NULL,
step = 0.025,
start_sep = 0,
tol = NULL,
direction = "inward",
base_r = 1,
shade = FALSE,
shape = FALSE,
group = NULL
)Arguments
- data
A data frame with an angle column in radians.
- col
Name of the angle column. Defaults to the
heading_colattribute whendatais aheadings_frame.- step
Radial gap between successive dots in a stack, in data units (the analogue of
circular::plot.circular'ssep). Default0.025matches that package; larger values separate the dots more.- start_sep
Radial offset of the first (outermost, for
"inward") dot frombase_r, in data units (the analogue ofcircular::plot.circular'sstart.sep). Default0places the first dot on the reference circle. A small positive value shifts the whole stack off the line so the dots abut rather than straddle it.- tol
Grouping tolerance in radians.
NULL(default) = exact equality, correct for binned data.tol > 0assigns each observation to the nearest group centre withintolradians (greedy, sorted-order scan); angles near0and2*piare not treated as neighbours.- direction
"inward"(default, stacks toward centre) or"outward"(away from perimeter, matchescirculardefault).- base_r
Radius of the reference circle in data units. Default 1.
- shade
If
TRUE, add ashade_ncolumn (alias ofstack_n) for use as an alpha aesthetic.- shape
If
TRUE, add ashape_codeinteger column: 1 = hollow (outermost / singleton), 2 = filled (middle), 3 = filled with ring (innermost in a stack of 3+).- group
Optional column name; when set, stacking is computed independently within each group and the rows recombined. Default
NULL.
Value
data augmented with stack_r and stack_n
columns (always), plus shade_n and/or shape_code when
requested. Row count is unchanged.
See also
headings_frame, add_stacked_headings