R中的圆形时间图与堆积的玫瑰

时间:2013-09-06 00:39:44

标签: r ggplot2 rose-diagram

我在excel中导入了一个数据框,其中包含以下值:

> dt <- read.csv(file="teste1.csv",head=TRUE,sep=";")
> dt
   hour occur     time    tt
1     1   one 00:00:59    59
2     2   one 08:40:02 31202
3     3   one 07:09:59 25799
4     4   one 01:22:16  4936
5     5   one 01:30:28  5428
6     6   one 01:28:57  5337
7     7   one 19:05:34 68734
8     8   one 01:57:47  7067
9     9   one 00:13:17   797
10   10   one 12:14:48 44088
11   11   one 23:24:43 84283
12   12   one 13:23:14 48194
13   13   one 02:28:51  8931
14   14   one 14:21:24 51684
15   15   one 13:26:14 48374
16   16   one 00:27:24  1644
17   17   one 15:56:51 57411
18   18   one 11:07:50 40070
19   19   one 07:18:18 26298
20   20   one 07:33:13 27193
21   21   one 10:02:03 36123
22   22   one 11:30:32 41432
23   23   one 21:21:27 76887
24   24   one 00:49:18  2958
25    1   two 21:01:11 75671
26    2   two 11:00:40 39640
27    3   two 21:40:09 78009
28    4   two 01:05:37  3937
29    5   two 00:44:17  2657
30    6   two 12:43:21 45801
31    7   two 10:53:49 39229
32    8   two 08:29:09 30549
33    9   two 05:07:46 18466
34   10   two 17:32:37 63157
35   11   two 09:35:16 34516
36   12   two 03:04:19 11059
37   13   two 23:09:13 83353
38   14   two 01:15:49  4549
39   15   two 14:24:33 51873
40   16   two 01:12:53  4373
41   17   two 21:20:11 76811
42   18   two 02:25:21  8721
43   19   two 01:17:37  4657
44   20   two 15:07:50 54470
45   21   two 22:27:32 80852
46   22   two 01:41:07  6067
47   23   two 09:40:23 34823
48   24   two 05:31:17 19877

我想根据数据框创建一个堆叠玫瑰的循环时间,即每个堆叠的玫瑰按列分组,大小由列时间定义。

列时间表示每个玫瑰的x位置。

所以我尝试了这种方式,但结果与我想要的不相符:

ggplot(dt, aes(x = hour, fill = occur)) + geom_histogram(breaks = seq(0, 
    24), width = 2, colour = "grey") + coord_polar(start = 0) + theme_minimal() + 
    scale_fill_brewer() + scale_x_continuous("", limits = c(0, 24), breaks = seq(0, 24), labels = seq(0, 
        24))

我做错了什么?我想要这样的东西http://blog.odotech.com/Portals/57087/images/French%20landfill%20wind%20rose.png

我希望我已经正确解释了。谢谢!

0 个答案:

没有答案