9.17 Radar Charts

  • A radar chart (also called a spider or star chart) displays one or more groups or observations on three or more quantitative variables.

  • Radar charts can be created with ggradar function in the ggradar package. Unfortunately, the package in not available on CRAN, so we have to install it from Github.

  • We have to put the data in a specific format where (1) the first variable is called group and contains the identifier for each observation and (2) the numeric variables are scaled so that their values range from 0 to 1.

#devtools::install_github("ricardo-bion/ggradar")

data(msleep, package = "ggplot2") # prepare data
library(ggradar); library(scales); library(dplyr)

plotdata <- msleep %>%
  filter(name %in% c("Cow", "Dog", "Pig")) %>%
  select(name, sleep_total, sleep_rem, 
         sleep_cycle, brainwt, bodywt) %>%
  rename(group = name) %>%
  mutate_at(vars(-group),
            funs(rescale))
plotdata
## # A tibble: 3 × 6
##   group sleep_total sleep_rem sleep_cycle brainwt bodywt
##   <chr>       <dbl>     <dbl>       <dbl>   <dbl>  <dbl>
## 1 Cow         0         0             1     1      1    
## 2 Dog         1         1             0     0      0    
## 3 Pig         0.836     0.773         0.5   0.312  0.123