我正在尝试使用和 ggplot2 (或 R 中的任何其他包)制作雷达图,如附图中所示。This talk about this 但我的情况不同,因为我正在尝试为具有特定范围的响应数据创建蜘蛛图。我使用如下代码制作了一个绘图,但我无法弄清楚如何在图像中制作它。请帮我解决这个问题。
Impcts <- c("system","supply","security","well-being")
present <- c(5,5,3,5)
past <- c(6,6,4,5)
group.names <- c("present", "past")
ddf.pre <- data.frame(matrix(c(rep(group.names[1], 4), Impcts), nrow = 4, ncol = 2), var.order = seq(1:4), value = present)
ddf.pas <- data.frame(matrix(c(rep(group.names[2], 4), Impcts), nrow = 4, ncol = 2), var.order = seq(1:4), value = past)
ddf <- rbind(ddf.pre, ddf.pas)
colnames(ddf) <- c("Group", "Impcts", "var.order", "var.value")
library(ggplot2)
ggplot(ddf, aes(y = var.value, x = reorder(Impcts, var.order),
group = Group, colour = Group))+
coord_polar() +
geom_path() +
geom_point()+
labs(title = "Impacts Analysis").