Circular time plots in R with stacked rose
I have an matrix imported in excel with the following values:
> matrix <- read.csv(file="teste1.csv",head=TRUE,sep=";")
> matrix
hour occur time
1 1 one 0:00:59
2 2 one 8:40:02
3 3 one 7:09:59
4 4 one 1:22:16
5 5 one 1:30:28
6 6 one 1:28:57
7 7 one 19:05:34
8 8 one 1:57:47
9 9 one 0:13:17
10 10 one 12:14:48
11 11 one 23:24:43
12 12 one 13:23:14
13 13 one 2:28:51
14 14 one 14:21:24
15 15 one 13:26:14
16 16 one 0:27:24
17 17 one 15:56:51
18 18 one 11:07:50
19 19 one 7:18:18
20 20 one 7:33:13
21 21 one 10:02:03
22 22 one 11:30:32
23 23 one 21:21:27
24 24 one 0:49:18
25 1 two 21:01:11
26 2 two 11:00:40
27 3 two 21:40:09
28 4 two 1:05:37
29 5 two 0:44:17
30 6 two 12:43:21
31 7 two 10:53:49
32 8 two 8:29:09
33 9 two 5:07:46
34 10 two 17:32:37
35 11 two 9:35:16
36 12 two 3:04:19
37 13 two 23:09:13
38 14 two 1:15:49
39 15 two 14:24:33
40 16 two 1:12:53
41 17 two 21:20:11
42 18 two 2:25:21
43 19 two 1:17:37
44 20 two 15:07:50
45 21 two 22:27:32
46 22 two 1:41:07
47 23 two 9:40:23
48 24 two 5:31:17
I want to create a circular time with stacked rose based on the matrix,
ie, each stacked rose are grouped by column occur, and the size is defined
by column time.
The column hour indicates the x position of each rose.
So I tried in this way but the result doesn't match with what I want:
ggplot(matrix, 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))
What I'm doing wrong? I want something like this
http://blog.odotech.com/Portals/57087/images/French%20landfill%20wind%20rose.png
I hope I've explained correctly. Thank you!
No comments:
Post a Comment