-
Notifications
You must be signed in to change notification settings - Fork 0
/
catwalk_publication_graph.rmd
141 lines (106 loc) · 3.73 KB
/
catwalk_publication_graph.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
title: "R Notebook"
output: html_notebook
---
```{r}
facet_graph <- cat_df %>%
gather(iv, dv = front_bos:hind_stepcyc)
g1 <- ggplot(facet_graph, aes(x = run_speed, y = value)) +
geom_point() +
facet_grid(iv~sex, scales = "free_y") +
geom_smooth(method= "lm", color = "black", se = F) +
geom_point(aes(fill = age), size = 3, shape = 21, color = "black") +
scale_fill_manual(values = c("white", "grey", "black"))
g1
ggsave("")
```
```{r}
facet_graph <- cat_df %>%
gather(iv, dv = front_bos:hind_stepcyc)
ggplot(cat_df, aes(x = run_speed, y = hind_strlen, fill = age)) +
geom_point() +
facet_grid(~sex) +
geom_smooth(aes(color = age), method= "lm", se = F) +
geom_point(aes(fill = age), size = 3, shape = 21, color = "black") +
scale_fill_manual(values = c("white", "grey", "black"))
head(cat_df)
```
```{r}
ggplot(cat_df, aes(x = run_speed, y = front_strlen, fill = age)) +
geom_point() +
facet_grid(~sex) +
geom_smooth(aes(color = age), method= "lm", se = F) +
geom_point(aes(fill = age), size = 3, shape = 21, color = "black") +
scale_fill_manual(values = c("white", "grey", "black"))
```
```{r}
log_step <- cat_df %>%
mutate(step_log10 =log10(front_stepcyc)) %>%
filter(age != "10 Month")
log_step
ggplot(log_step, aes(x = run_speed, y = step_log10)) +
geom_point() +
geom_smooth(method= "lm", color = "black", se = F) +
geom_point(aes(fill = age), size = 3, shape = 21, color = "black") +
scale_fill_manual(values = c("white", "black"))
```
```{r, eval = F}
cat_df2 <- data.frame(cat_sum_df)
viz_func <- function(data, x, y, z, y.min){
ggplot(data,
aes(x = x, y = y, fill = z, group = z)) +
geom_errorbar(aes(ymin = y,
ymax = y + y.min),
position = "dodge", width = 0.5) +
geom_bar(color = "black", stat = "identity", width = 0.7,
position = "dodge")
}
viz_func(cat_df2, age, front_bos_mean, gt, run_speed_se)
```
```{r}
head(cat_sum_df)
```
run_speed graph
```{r}
pd_bar <- position_dodge(width = 0.9)
ggplot(cat_sum_df,
aes(x = age, y = run_speed_mean, fill = gt, group = gt)) +
geom_errorbar(aes(ymin = run_speed_mean,
ymax = run_speed_mean + run_speed_se), position = pd_bar, width = 0.5) +
geom_bar(color = "black", stat = "identity", width = 0.7, position = pd_bar) +
facet_grid(~sex)
```
bos_front graph
```{r}
ggplot(cat_sum_df,
aes(x = age, y = run_speed_mean, fill = gt, group = gt)) +
geom_errorbar(aes(ymin = run_speed_mean,
ymax = run_speed_mean + run_speed_se), position = pd_bar, width = 0.5) +
geom_bar(color = "black", stat = "identity", width = 0.7, position = pd_bar) +
facet_grid(~sex)
```
This one is working!
```{r,eval = F}
cat_sum_df2 <- cat_df %>%
group_by(age, gt, sex) %>%
summarize_at(vars(run_speed:hind_stepcyc), funs(mean, se))
```
```{r}
pd_bar <- position_dodge(width = 0.9)
ggplot(data = cat_sum_df,
aes(x = age, y = run_speed_mean, fill = gt,
group = gt)) +
geom_errorbar(aes(ymin = run_speed_mean - run_speed_se,
ymax = run_speed_mean + run_speed_se), width = 0.5, position = pd_bar) +
geom_bar(color = "black", stat = "identity", width = 0.7, position = pd_bar) +
facet_grid(~sex) +
theme_bw() +
scale_fill_manual(values = c("white","black")) +
theme(legend.position = "NULL",
legend.title = element_blank(),
axis.title = element_text(size = 20),
legend.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(size = 12))
```