Skip to content

Commit 48266e5

Browse files
author
Max Czapanskiy
committed
Fix Fig S1. Requires manual editing now, boo.
1 parent 33f2041 commit 48266e5

File tree

4 files changed

+5689
-7
lines changed

4 files changed

+5689
-7
lines changed

analysis/figures/S1.svg

Lines changed: 852 additions & 0 deletions
Loading

analysis/figures/S1_edited.svg

Lines changed: 4824 additions & 0 deletions
Loading

analysis/supplementary-materials/supplemental.Rmd

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,14 @@ peak_tbl <- tibble(dt = bw_400hz$dt[peaks[, 2]],
116116
prominence = proms,
117117
is_beat = dist_max <= dist_thr)
118118
119-
regionsample <- filter(bw_400hz, region_id == 6)
119+
regionsample <- filter(bw_400hz, region_id == 6) %>%
120+
mutate(secs = as.numeric(dt - min(dt), unit = "secs"))
120121
peaksample <- filter(peak_tbl, between(dt,
121122
first(regionsample$dt),
122123
last(regionsample$dt))) %>%
123124
arrange(dt) %>%
124-
mutate(peak_lbl = seq(n()))
125+
mutate(peak_lbl = seq(n()),
126+
secs = as.numeric(dt - min(regionsample$dt)))
125127
126128
max_height <- max(peaks[, 1])
127129
thr_curve <- tibble(
@@ -131,17 +133,16 @@ thr_curve <- tibble(
131133
) %>%
132134
filter(height <= max_height, prominence <= max_height)
133135
134-
pA <- ggplot(regionsample, aes(dt, jerk_smooth)) +
136+
pA <- ggplot(regionsample, aes(secs, jerk_smooth)) +
135137
geom_line() +
136138
geom_point(aes(y = height, color = is_beat), data = peaksample) +
137139
geom_text(aes(y = height, label = peak_lbl),
138140
data = peaksample,
139141
vjust = -0.3) +
140142
scale_color_manual(values = c("red", "blue")) +
141-
labs(x = "", y = "Y") +
143+
labs(x = "Seconds", y = "Y") +
142144
theme_classic(base_size = 10) +
143-
theme(axis.title.x = element_blank(),
144-
legend.position = "FALSE")
145+
theme(legend.position = "FALSE")
145146
146147
pB <- ggplot(peaksample, aes(height, prominence, color = is_beat)) +
147148
geom_point() +
@@ -171,5 +172,10 @@ pD <- ggplot(peak_tbl, aes(height, prominence)) +
171172
theme_classic(base_size = 10) +
172173
theme(legend.position = "FALSE")
173174
174-
cowplot::plot_grid(pA, pB, pC, pD, ncol = 2, labels = "AUTO")
175+
# Figure S1 requires manual adjustments. Save to .svg, edit in Inkscape, then
176+
# export back to PNG and insert here.
177+
S1 <- cowplot::plot_grid(pA, pB, pC, pD, ncol = 2, labels = "AUTO")
178+
ggsave(here::here("analysis/figures/S1.svg"), S1)
179+
cowplot::ggdraw() +
180+
cowplot::draw_image(here::here("analysis/figures/S1_edited.svg"))
175181
```
-56.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)