class: center, middle, inverse, title-slide # Exploded code ## Using flipbookr and xaringan ### Me --- <style type="text/css"> .remark-code{line-height: 1.5; font-size: 70%} @media print { .has-continuation { display: block; } } code.r.hljs.remark-code{ position: relative; overflow-x: hidden; } code.r.hljs.remark-code:hover{ overflow-x:visible; width: 500px; border-style: solid; } </style> --- count: false .panel1-setup-auto[ ```r *knitr::opts_chunk$set(echo = TRUE) ``` ] .panel2-setup-auto[ ] <style> .panel1-setup-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-setup-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-setup-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false .panel1-cars-auto[ ```r *library(tidyverse) ``` ] .panel2-cars-auto[ ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) *library(ggstamp) ``` ] .panel2-cars-auto[ ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) *set.seed(1243) ``` ] .panel2-cars-auto[ ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) *tibble::tibble(x = rnorm(40000, sd = .7), * y = rnorm(40000, sd = .7)) ``` ] .panel2-cars-auto[ ``` # A tibble: 40,000 x 2 x y <dbl> <dbl> 1 -0.265 -0.611 2 -0.716 -0.231 3 -0.497 0.0997 4 0.579 0.807 5 -0.149 -0.459 6 -0.413 -0.857 7 -0.611 0.806 8 -0.445 0.422 9 1.21 1.13 10 -1.00 -0.330 11 0.0725 0.695 12 -0.180 -0.934 13 -0.824 -0.0989 14 0.667 0.288 15 0.743 0.780 16 0.111 -0.860 17 -0.226 -1.43 18 0.308 -0.190 19 0.000328 0.419 20 -0.624 -0.333 21 0.641 -0.484 22 0.753 0.0155 23 1.29 -0.403 24 -0.0655 -0.411 25 1.17 0.762 26 -0.586 -0.593 27 1.62 0.237 28 -0.845 -0.766 29 -0.644 -1.27 30 -0.271 -0.147 31 -0.772 0.0690 32 -0.568 -0.157 33 -0.415 -1.03 34 1.14 0.0885 35 1.50 0.133 36 -0.219 -0.236 37 -0.110 -0.946 38 -1.25 -0.385 39 -1.00 -0.640 40 -0.369 0.791 41 -0.906 -0.138 42 0.787 0.121 43 -0.352 0.265 44 0.909 -0.144 45 -0.641 1.36 46 0.219 0.0975 47 1.02 -0.604 48 0.455 -0.147 49 -0.387 0.184 50 0.889 -1.46 51 0.682 0.0324 52 -0.169 0.368 53 0.309 -0.780 54 0.932 -0.644 55 -0.308 -0.498 # … with 39,945 more rows ``` ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% * ggplot() ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_05_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + * aes(x = x, y = y) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_06_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + * geom_hex(show.legend = F, color = alpha("white", 0)) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_07_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + * coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_08_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + * stamp_polygon_inverse(radius = 2, radius_outer = Inf, * fill = "green", color = "red" * ) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_09_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + * stamp_polygon(alpha = .2, n = 5, size = 1.75, * fill = "magenta", color = "grey15", * rotation = -.55) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_10_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + * stamp_polygon(radius = .4, n = 3, * x0 = .3, y0 = .77, rotation = -.4, * alpha = 1, fill = "orange", size = 0) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_11_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + * stamp_text(angle = 30, label = "ggstamp", * x = .7, y = -1, * color = "snow1") ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_12_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + * stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", * x = .7, y = -1.45, size = 1.8, * color = "grey85") ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_13_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", x = .7, y = -1.45, size = 1.8, color = "grey85") + * stamp_polygon(radius = 2, * alpha = 0, size = 2, * color = "plum3") ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_14_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", x = .7, y = -1.45, size = 1.8, color = "grey85") + stamp_polygon(radius = 2, alpha = 0, size = 2, color = "plum3") + * theme_void_fill(fill = "green") ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_15_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", x = .7, y = -1.45, size = 1.8, color = "grey85") + stamp_polygon(radius = 2, alpha = 0, size = 2, color = "plum3") + theme_void_fill(fill = "green") + * ggxmean::stamp_normal_dist(sd = .2, alpha = .8, height = 1.5) ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_16_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", x = .7, y = -1.45, size = 1.8, color = "grey85") + stamp_polygon(radius = 2, alpha = 0, size = 2, color = "plum3") + theme_void_fill(fill = "green") + ggxmean::stamp_normal_dist(sd = .2, alpha = .8, height = 1.5) + * stamp_point(xy = pos_wrap(n = 22, ncol = 6, width = .15, x0 = -.95, y0 = -.3), size = 3, * color = "seagreen2") ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_17_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r library(tidyverse) library(ggstamp) set.seed(1243) tibble::tibble(x = rnorm(40000, sd = .7), y = rnorm(40000, sd = .7)) %>% ggplot() + aes(x = x, y = y) + geom_hex(show.legend = F, color = alpha("white", 0)) + coord_equal(xlim = c(-3,3), ylim = c(-2.3, 2.3)) + stamp_polygon_inverse(radius = 2, radius_outer = Inf, fill = "green", color = "red" ) + stamp_polygon(alpha = .2, n = 5, size = 1.75, fill = "magenta", color = "grey15", rotation = -.55) + stamp_polygon(radius = .4, n = 3, x0 = .3, y0 = .77, rotation = -.4, alpha = 1, fill = "orange", size = 0) + stamp_text(angle = 30, label = "ggstamp", x = .7, y = -1, color = "snow1") + stamp_text(angle = 30, label = "github.com/EvaMaeRey/ggstamp", x = .7, y = -1.45, size = 1.8, color = "grey85") + stamp_polygon(radius = 2, alpha = 0, size = 2, color = "plum3") + theme_void_fill(fill = "green") + ggxmean::stamp_normal_dist(sd = .2, alpha = .8, height = 1.5) + stamp_point(xy = pos_wrap(n = 22, ncol = 6, width = .15, x0 = -.95, y0 = -.3), size = 3, color = "seagreen2") -> *g; g ``` ] .panel2-cars-auto[ ![](hex_transparency_flipbook_files/figure-html/cars_auto_18_output-1.png)<!-- --> ] <style> .panel1-cars-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-cars-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-cars-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false .panel1-magick-auto[ ```r *ggsave("hex_sticker_ggstamp.png", plot = g, dpi = 320) ``` ] .panel2-magick-auto[ ] --- count: false .panel1-magick-auto[ ```r ggsave("hex_sticker_ggstamp.png", plot = g, dpi = 320) *magick::image_read("hex_sticker_ggstamp.png") ``` ] .panel2-magick-auto[ <img src="hex_transparency_flipbook_files/figure-html/magick_auto_02_output-1.png" width="2559" /> ] --- count: false .panel1-magick-auto[ ```r ggsave("hex_sticker_ggstamp.png", plot = g, dpi = 320) magick::image_read("hex_sticker_ggstamp.png") %>% * magick::image_fill("transparent", "+40+40", fuzz = 40) ``` ] .panel2-magick-auto[ <img src="hex_transparency_flipbook_files/figure-html/magick_auto_03_output-1.png" width="2559" /> ] --- count: false .panel1-magick-auto[ ```r ggsave("hex_sticker_ggstamp.png", plot = g, dpi = 320) magick::image_read("hex_sticker_ggstamp.png") %>% magick::image_fill("transparent", "+40+40", fuzz = 40) %>% * magick::image_write("hex_sticker_ggstamp2.png") ``` ] .panel2-magick-auto[ ] <style> .panel1-magick-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-magick-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-magick-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style>