Draws a hollow circle at `(cos(heading), sin(heading))` for each row of a headings data frame, placing one marker per trajectory on the unit-circle boundary at the derived heading direction. The data frame is normally the output of [derive_headings()].
Usage
add_heading_points(
headings_df,
colour_col = NULL,
colour = NULL,
size = 2,
alpha = 1,
axial = FALSE,
color_col = NULL,
color = NULL
)Arguments
- headings_df
Data frame with a `heading` column (angles in radians).
- colour_col, color_col
Name of a column in `headings_df` to map to the colour aesthetic. When `NULL` (default), the value of `attr(headings_df, "colour_col")` is used if set – so heading markers automatically inherit the colour mapping from the associated trajectory plot when that attribute is present. Ignored when `colour` is supplied. `color_col` is the American-spelling alias.
- colour, color
Fixed colour string. Overrides `colour_col` when supplied; when `NULL` and no `colour_col` resolves, defaults to `"black"`. `color` is the American-spelling alias.
- size
Point size passed to `geom_point`.
- alpha
Point alpha transparency.
- axial
Logical; when `TRUE`, draw each observation at both `heading` and `heading + pi` (bidirectional/axial display). Default `FALSE`.
American spellings
Every `colour...` argument and the `assign_colour_*` / `cycle_colours` / `hf_colour_col` functions accept the American `color...` spelling as an alias (e.g. `color`, `color_col`, `track_color`). British spelling is canonical; supplying both spellings of a pair is an error.
Examples
library(ggplot2)
# headings from a Tracks via derive_headings(ts, rule = "crossing", ...)
hd <- data.frame(id = "A", time = 1, heading = pi / 4)
ggplot() + coord_fixed() + add_heading_points(hd)
ggplot() + coord_fixed() + add_heading_points(hd, colour = "steelblue")
