| plot_radar | R Documentation |
Radar (spider) chart for a single profile of variables using radial axes.
plot_radar(data, label_x = "", label_y = "", colors = NULL)
data |
two‑column data.frame: variable name and value |
label_x |
x‑axis label (unused; variable names are shown around the circle) |
label_y |
y‑axis label |
colors |
line/fill color for the polygon |
Expects a two‑column data.frame with variable names in the first column and numeric values in the second.
The graphic is built as an n-sided polygon, where n is the number of variables, so at least three
variables are required. The function already sets the drawing limits for the full polygon; adding
ylim() or other Cartesian clipping after the fact can hide part of the radar.
returns a ggplot2::ggplot graphic
data <- data.frame(name = "Petal.Length", value = mean(iris$Petal.Length))
data <- rbind(data, data.frame(name = "Petal.Width", value = mean(iris$Petal.Width)))
data <- rbind(data, data.frame(name = "Sepal.Length", value = mean(iris$Sepal.Length)))
data <- rbind(data, data.frame(name = "Sepal.Width", value = mean(iris$Sepal.Width)))
grf <- plot_radar(data, colors = "red")
plot(grf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.