forked from gadenbuie/tidyexplain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
union.R
42 lines (31 loc) · 1.12 KB
/
union.R
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
source(here::here("R/00_base_set.R"))
# ---- union(x, y) ----
uxy <- bind_rows(
initial_set_dfs,
union(x, y) %>% proc_data_set("xy") %>% mutate(frame = 2, .x = .x + 1.5),
intersect(x, y) %>% proc_data_set("xy") %>% mutate(frame = 2, .y = -4, .x = .x + 1.5)
) %>%
plot_data_set("union(x, y)", ylims = ylim(-4.5, -0.5)) %>%
animate_plot()
uxy <- animate(uxy)
anim_save(here::here("images", "union.gif"), uxy)
uxy_g <- union(x, y) %>%
proc_data_set() %>%
mutate(.x = .x + 1.5) %>%
plot_data_set("union(x, y)", ylims = ylim(-0.5, -4.5))
save_static_plot(uxy_g, "union")
# ---- union(y, x) ----
uyx <- bind_rows(
initial_set_dfs,
union(y, x) %>% proc_data_set("xy") %>% mutate(frame = 2, .x = .x + 1.5),
intersect(y, x) %>% proc_data_set("xy") %>% mutate(frame = 2, .y = -4, .x = .x + 1.5)
) %>%
plot_data_set("union(y, x)", ylims = ylim(-4.5, -0.5)) %>%
animate_plot()
uyx <- animate(uyx)
anim_save(here::here("images", "union-rev.gif"), uyx)
uyx_g <- union(y, x) %>%
proc_data_set() %>%
mutate(.x = .x + 1.5) %>%
plot_data_set("union(y, x)", ylims = ylim(-4.5, -0.5))
save_static_plot(uyx_g, "union-rev")