Skip to contents

For long data, map the axis ID to axis and the raw measurement to value. Explicitly map group to the profile, or use group = 1 for a single profile per panel. Colours, fills and other styles use standard ggplot2 scales. A filled profile needs constant fill and alpha.

Usage

geom_radar(
  mapping = NULL,
  data = NULL,
  position = "identity",
  ...,
  spec = NULL,
  limits = NULL,
  missing = c("error", "gap", "omit_group"),
  points = FALSE,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

stat_radar(
  mapping = NULL,
  data = NULL,
  geom = "point",
  position = "identity",
  ...,
  spec = NULL,
  limits = NULL,
  missing = c("error", "gap", "omit_group"),
  label_offset = 0.07,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

geom_radar_label(
  mapping = NULL,
  data = NULL,
  position = "identity",
  ...,
  spec = NULL,
  limits = NULL,
  missing = c("error", "gap", "omit_group"),
  label_offset = 0.07,
  na.rm = FALSE,
  show.legend = FALSE,
  inherit.aes = TRUE
)

Arguments

mapping

A mapping from ggplot2::aes().

data

Layer data. NULL inherits the plot data.

position

Identity position adjustment.

...

Fixed aesthetics and geom parameters.

spec

Optional specification from radar_spec(). Reuse it when different layers should use the same axis order and scale.

limits

Two finite, increasing numbers for one shared scale, or a data frame with axis, lower and upper columns for per-axis scales. In the table, give each axis ID exactly once. Bounds use the original units and must be finite, increasing and have a finite span. An optional breaks list-column supplies distinct, in-range tick values for each axis. Use NULL for default ticks or numeric(0) to omit an axis's ticks. When the entire limits argument is NULL, one range covers zero and all observed values. Supply explicit bounds when comparing separate figures.

missing

How to handle NA or a missing axis row. Use "error", "gap" for open lines and points, or "omit_group" to drop incomplete profiles. Missing axes leave both incident edges open.

points

Draw points at observed values.

na.rm

Standard ggplot2 geom argument. Radar input missingness is controlled by missing.

show.legend, inherit.aes

Standard ggplot2 layer settings.

geom

Geom object or name for stat_radar(). The default draws points at the computed coordinates. Use geom = "radar" for profiles that respect missing edges. A stock path or polygon connects the rows it receives according to its own drawing rules.

label_offset

Signed distance from the point in normalized radius units. Positive values move labels outward, negative values move them inward up to the centre.

Value

A ggplot2 layer.

Details

With no explicit specification, each layer computes its order and any automatic range from all its data across panels. An explicit per-axis limits table is matched by axis ID. Give multiple layers the same spec when they use different data. With an explicit specification, absent axes are handled according to the missing policy. Use fixed facet scales and ggplot2::coord_fixed() to preserve equal units. Use clip = "off", suitable plot margins and theme(panel.spacing.x = ...) as needed for long labels in adjacent facets.

Computed variables

The stat supplies x, y, axis, axis_index, value, radius (0 to 1), theta (radians), value_label, label_x, label_y, label_hjust and label_vjust. Use these with ggplot2::after_stat(). geom_radar_label() defaults to the original value at its outward anchor.

Examples

d <- data.frame(axis = rep(c("Detection", "Lab", "Response"), 2),
                score = c(72, 62, 87, 78, 81, 60),
                period = rep(c("Before", "After"), each = 3))
spec <- radar_spec(c("Detection", "Lab", "Response"), c(0, 100))
p <- ggplot2::ggplot(d, ggplot2::aes(axis = axis, value = score, group = 1))
p + geom_radar_grid(spec) + geom_radar(spec = spec) +
  geom_radar_label(spec = spec) +
  ggplot2::facet_wrap(~ period) + ggplot2::coord_fixed()