Learn R Programming

see (version 0.5.0)

coord_radar: Radar coordinate system

Description

Add a radar coordinate system useful for radar charts.

Usage

coord_radar(theta = "x", start = 0, direction = 1, ...)

Arguments

theta

Can be 'x' or 'y'.

start

Starting position. Best expressed in terms of pi (e.g., -pi/4).

direction

The direction of plotting. Can be 1 or -1.

...

Other arguments to be passed to ggproto.

Examples

Run this code
# NOT RUN {
# Create a radar/spider chart with ggplot:
if (require("dplyr") && require("tidyr") && require("ggplot2")) {
  data <- iris %>%
    group_by(Species) %>%
    summarise_all(mean) %>%
    pivot_longer(-Species)

  data %>%
    ggplot(aes(x = name, y = value, color = Species, group = Species)) +
    geom_polygon(fill = NA, size = 2) +
    coord_radar(start = -pi/4)
}
# }

Run the code above in your browser using DataLab