CalculateAxisPath | R Documentation |
Calculates x-y coordinates for a set of radial axes (one per variable being plotted in radar plot)
CalculateAxisPath(var.names, min, max)
var.names |
list of variables to be plotted on radar plot |
min |
MININUM value required for the plotted axes (same value will be applied to all axes) |
max |
MAXIMUM value required for the plotted axes (same value will be applied to all axes) |
a dataframe of the calculated axis paths
library(dplyr)
library(scales)
library(tibble)
mtcars_radar <- mtcars %>%
as_tibble(rownames = "group") %>%
mutate_at(vars(-group), rescale) %>%
tail(4) %>%
select(1:10)
plot.data <- as.data.frame(mtcars_radar)
if(!is.factor(plot.data[, 1])) {
plot.data[, 1] <- as.factor(as.character(plot.data[, 1]))
}
names(plot.data)[1] <- "group"
var.names <- colnames(plot.data)[-1]
grid.min = 0
grid.max = 1
centre.y = grid.min - ((1 / 9) * (grid.max - grid.min))
CalculateAxisPath(var.names, grid.min + abs(centre.y), grid.max + abs(centre.y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.