我正在尝试使用R重新创建这种类型的图形,可能是ggplot,但没有加入该图形。
mydata <- data.frame(Group = letters[1:5],
Distance = seq(1000, 5000, 1000),
Change = c(-10, 5, -20, 15, -30))
# Input the same origin point
mydata <- rbind(mydata, data.frame(Group = letters[1:5], Distance = 0, Change = 0))
ggplot(mydata, aes(x = Change, y = Distance, group = Group)) + geom_line() + coord_polar(theta = "y")
但是我只是以螺旋形告终-而且我不确定从这儿去哪里。我不知道是否需要开始使用该角度并尝试从中建立x / y坐标。
答案 0 :(得分:0)
基于以上评论中的反馈-这是我想出的答案。谢谢大家。
library(ggplot2)
mydata <- data.frame(Group = letters[1:5],
Distance = seq(1000, 5000, 1000),
Change = c(-10, 5, -20, 15, -30))
# Input the same origin point
mydata <- rbind(mydata, data.frame(Group = letters[1:5], Distance = 0, Change = 0))
ggplot(mydata, aes(x = Change, y = Distance, color = Group)) + coord_polar(start = 3.5*pi*max(mydata$Change)/diff(range(mydata$Change))) +
geom_segment(aes(y = 0, xend = Change, yend = Distance))