[reference] https://github.com/ricardo-bion/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.
ggplot2 now has an official extension mechanism. This means that others can now easily create their own stats, geoms and positions, and provide them in other packages. This should allow the ggplot2 community to flourish, even as less development work happens in ggplot2 itself. This page showcases these extensions.
library(ggplot2)
library(ggradar)
suppressPackageStartupMessages(library(dplyr))
library(scales)
library(knitr)
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
mtcars %>%
add_rownames( var = "group" ) %>%
mutate_each(funs(rescale), -group) %>%
tail(4) %>% select(1:10) -> mtcars_radar
group | mpg | cyl | disp | hp | drat | wt | qsec | vs | am |
---|---|---|---|---|---|---|---|---|---|
Ford Pantera L | 0.2297872 | 1.0 | 0.6981791 | 0.7491166 | 0.6728111 | 0.4236768 | 0.0000000 | 0 | 1 |
Ferrari Dino | 0.3957447 | 0.5 | 0.1843352 | 0.4346290 | 0.3963134 | 0.3214012 | 0.1190476 | 0 | 1 |
Maserati Bora | 0.1957447 | 1.0 | 0.5734597 | 1.0000000 | 0.3594470 | 0.5259524 | 0.0119048 | 0 | 1 |
Volvo 142E | 0.4680851 | 0.0 | 0.1244699 | 0.2014134 | 0.6221198 | 0.3239581 | 0.4880952 | 1 | 1 |