ggradar

ggradar allows you to build radar charts with ggplot2. This package is based on Paul Williamson’s code, with new aesthetics and compatibility with ggplot2 2.0.

It was inspired by d3radaR, an htmlwidget built by timelyportfolio.

Install ggradar

devtools::install_github("ricardo-bion/ggradar", 
                          dependencies = TRUE)

Use ggradar

library(ggradar)
library(dplyr)
library(scales)
library(tibble)

mtcars_radar <- mtcars %>% 
  as_tibble(rownames = "group") %>% 
  mutate_at(vars(-group), rescale) %>% 
  tail(4) %>% 
  select(1:10)
groupmpgcyldisphpdratwtqsecvsam
Ford Pantera L0.22978721.00.69817910.74911660.67281110.42367680.000000001
Ferrari Dino0.39574470.50.18433520.43462900.39631340.32140120.119047601
Maserati Bora0.19574471.00.57345971.00000000.35944700.52595240.011904801
Volvo 142E0.46808510.00.12446990.20141340.62211980.32395810.488095211
ggradar(mtcars_radar)

Custom fonts

You can also use custom font family in ggradar. In the following example, you would like to use Airbnb’s font family named ‘Circular Air’ by first download it, install it in your computer, and then register it to R using extrafont package.

# configured to work on a Mac, change directory to Unix or Windows
download.file("https://github.com/ricardo-bion/ggtech/blob/master/Circular%20Air-Light%203.46.45%20PM.ttf", "~/Circular Air-Light 3.46.45 PM.ttf", method = "curl")

extrafont::font_import(pattern = 'Circular', prompt = FALSE)

Following the same procedure as in the previous example, you can then use ‘Circular Air’ font family in ggradar by adjusting font.radar argument. The following example shows that ggradar is also can be used in pipe %>%.

mtcars %>% 
  as_tibble(rownames = "group") %>% 
  mutate_at(vars(-group), rescale) %>% 
  tail(4) %>% 
  select(1:10) %>% 
  ggradar(font.radar = "Circular Air")

Copy Link

Version

Down Chevron

Version

0.2

License

GPL

Maintainer

Last Published

January 1st, 1970

Functions in ggradar (0.2)