找回密码
 立即注册
查看: 2905|回复: 2

R语言如何绘制Radial histograms?如图

[复制链接]
发表于 2017-2-24 13:20:39 | 显示全部楼层 |阅读模式
捕获.PNG
回复

使用道具 举报

 楼主| 发表于 2017-2-24 13:22:19 | 显示全部楼层
其中横轴及纵轴代表出现相应角度的频数
回复

使用道具 举报

 楼主| 发表于 2017-3-1 17:55:05 | 显示全部楼层
stackoverflow 上有人给了一个解决方案,能基本解决问题但还是histogram。。。。

d <- structure(list(Angle = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220,
230, 240, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 250
), Frequency = c(0, 0, 0.001, 2, 4, 18.03, 11, 12, 5, 7, 10,
13, 2, 0.003, 0.01, 0, 1, 0.05, 2, 3, 3.7, 6, 0, 0, 0, 0, 0.2,
0.006, 0, 0, 0, 0, 0, 0, 0, 0)), .Names = c("Angle", "Frequency"
), row.names = c(NA, 36L), class = "data.frame")

d$radian = d$Angle*pi/180
d$x = d$Frequency*cos(d$radian)
d$y = d$Frequency*sin(d$radian)
m = max(d$x, d$y)
graphics.off()
windows(width = 6, height = 6)

plot(x = m,
    y = m,
    xlim = c(-m,m),
    ylim = c(-m,m),
    type = "n",
    asp = 1,
    axes = FALSE,
    xlab = "",
    ylab = "")
par(xpd = TRUE)

symbols (x =c(0,0,0,0,0), y = c(0,0,0,0,0), circles=c(3,6,9,12,15), fg = "grey",
                                  add = TRUE, inches = FALSE, lty = 2)
lines(x = c(-15,15), y = c(0,0), lty = 2)
lines(x = c(0,0), y = c(-15,15), lty = 2)
text(x = c(0,0,-15,15), y = c(-15,15,0,0),
                           labels = c("180","0","270","90"), pos = c(1,3,2,4))

for (i in 1:nrow(d)){
    lines(x = c(0,d$x[i]), y = c(0,d$y[i]), lwd = 3)
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-22 20:07 , Processed in 0.033987 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表