class: center, middle, inverse, title-slide # continuous univariate and continuous X discrete ### Gina Reynolds --- ```r library(flipbookr) library(tidyverse) library(gapminder) ``` --- --- name: c # Continuous Univariate --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r *gapminder ``` ] .right-panel-univariate_continuous_build-auto[ ``` # A tibble: 1,704 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 1952 28.8 8425333 779. 2 Afghanistan Asia 1957 30.3 9240934 821. 3 Afghanistan Asia 1962 32.0 10267083 853. 4 Afghanistan Asia 1967 34.0 11537966 836. 5 Afghanistan Asia 1972 36.1 13079460 740. 6 Afghanistan Asia 1977 38.4 14880372 786. 7 Afghanistan Asia 1982 39.9 12881816 978. 8 Afghanistan Asia 1987 40.8 13867957 852. 9 Afghanistan Asia 1992 41.7 16317921 649. 10 Afghanistan Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r gapminder %>% * filter(year == 2002) ``` ] .right-panel-univariate_continuous_build-auto[ ``` # A tibble: 142 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 2002 42.1 25268405 727. 2 Albania Europe 2002 75.7 3508512 4604. 3 Algeria Africa 2002 71.0 31287142 5288. 4 Angola Africa 2002 41.0 10866106 2773. 5 Argentina Americas 2002 74.3 38331121 8798. 6 Australia Oceania 2002 80.4 19546792 30688. 7 Austria Europe 2002 79.0 8148312 32418. 8 Bahrain Asia 2002 74.8 656397 23404. 9 Bangladesh Asia 2002 62.0 135656790 1136. 10 Belgium Europe 2002 78.3 10311970 30486. # … with 132 more rows ``` ] --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% * ggplot() ``` ] .right-panel-univariate_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_build_auto_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + * aes(x = lifeExp) ``` ] .right-panel-univariate_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_build_auto_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + * theme_minimal() ``` ] .right-panel-univariate_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_build_auto_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + * geom_rug(col = "darkgrey") ``` ] .right-panel-univariate_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_build_auto_6_output-1.png" width="100%" /> ] <style> .left-panel-univariate_continuous_build-auto { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-univariate_continuous_build-auto { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-univariate_continuous_build-auto { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + geom_histogram(alpha = .5, fill = "cadetblue") ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_1_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_freqpoly(linetype = "dashed") ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_2_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_dotplot(fill = "blue", alpha = .5) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_dotplot(binwidth = "dotdensity", alpha = .5) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_histogram(col = "black", fill = "maroon4", alpha = .4, aes(y = ..density..)) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_density(linetype = "dotted", adjust = 1/4, size = 1.25) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_6_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_density(linetype = "dashed", adjust = 1/2, size = 1.25) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_7_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * ggalt::geom_bkde(alpha = 0.3 ) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_8_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-univariate_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * ggalt::geom_bkde(alpha = 0.3, bandwidth = .25, aes(fill = continent)) ``` ] .right-panel-univariate_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/univariate_continuous_rotate_9_output-1.png" width="100%" /> ] <style> .left-panel-univariate_continuous-rotate { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-univariate_continuous-rotate { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-univariate_continuous-rotate { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- --- name: c # Continuous - Discrete via facetting --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r *gapminder ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ ``` # A tibble: 1,704 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 1952 28.8 8425333 779. 2 Afghanistan Asia 1957 30.3 9240934 821. 3 Afghanistan Asia 1962 32.0 10267083 853. 4 Afghanistan Asia 1967 34.0 11537966 836. 5 Afghanistan Asia 1972 36.1 13079460 740. 6 Afghanistan Asia 1977 38.4 14880372 786. 7 Afghanistan Asia 1982 39.9 12881816 978. 8 Afghanistan Asia 1987 40.8 13867957 852. 9 Afghanistan Asia 1992 41.7 16317921 649. 10 Afghanistan Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r gapminder %>% * filter(year == 2002) ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ ``` # A tibble: 142 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 2002 42.1 25268405 727. 2 Albania Europe 2002 75.7 3508512 4604. 3 Algeria Africa 2002 71.0 31287142 5288. 4 Angola Africa 2002 41.0 10866106 2773. 5 Argentina Americas 2002 74.3 38331121 8798. 6 Australia Oceania 2002 80.4 19546792 30688. 7 Austria Europe 2002 79.0 8148312 32418. 8 Bahrain Asia 2002 74.8 656397 23404. 9 Bangladesh Asia 2002 62.0 135656790 1136. 10 Belgium Europe 2002 78.3 10311970 30486. # … with 132 more rows ``` ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r gapminder %>% filter(year == 2002) %>% * ggplot() ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_build_auto_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + * aes(x = lifeExp) ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_build_auto_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + * theme_minimal() ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_build_auto_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet_build-auto[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + * geom_rug(col = "darkgrey") ``` ] .right-panel-geom_discrete_continuous_facet_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_build_auto_6_output-1.png" width="100%" /> ] <style> .left-panel-geom_discrete_continuous_facet_build-auto { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-geom_discrete_continuous_facet_build-auto { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-geom_discrete_continuous_facet_build-auto { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + geom_histogram(alpha = .5, fill = "cadetblue") + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_1_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_freqpoly(linetype = "dashed") + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_2_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_dotplot(fill = "blue", alpha = .5) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_dotplot(binwidth = "dotdensity", alpha = .5) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_histogram(col = "black", fill = "maroon4", alpha = .4, aes(y = ..density..)) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_density(linetype = "dotted", adjust = 1/4, size = 1.25) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_6_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * geom_density(linetype = "dashed", adjust = 1/2, size = 1.25) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_7_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * ggalt::geom_bkde(alpha = 0.3 ) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_8_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_facet-rotate[ ```r gapminder %>% filter(year == 2002) %>% ggplot() + aes(x = lifeExp) + theme_minimal() + geom_rug(col = "darkgrey") + * ggalt::geom_bkde(alpha = 0.3, bandwidth = .25, aes(fill = continent)) + facet_grid(continent ~ .) ``` ] .right-panel-geom_discrete_continuous_facet-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_facet_rotate_9_output-1.png" width="100%" /> ] <style> .left-panel-geom_discrete_continuous_facet-rotate { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-geom_discrete_continuous_facet-rotate { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-geom_discrete_continuous_facet-rotate { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- --- class: inverse, center, middle name: dc ## Discrete v. Continuous --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r *gapminder ``` ] .right-panel-geom_discrete_continuous_build-auto[ ``` # A tibble: 1,704 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 1952 28.8 8425333 779. 2 Afghanistan Asia 1957 30.3 9240934 821. 3 Afghanistan Asia 1962 32.0 10267083 853. 4 Afghanistan Asia 1967 34.0 11537966 836. 5 Afghanistan Asia 1972 36.1 13079460 740. 6 Afghanistan Asia 1977 38.4 14880372 786. 7 Afghanistan Asia 1982 39.9 12881816 978. 8 Afghanistan Asia 1987 40.8 13867957 852. 9 Afghanistan Asia 1992 41.7 16317921 649. 10 Afghanistan Asia 1997 41.8 22227415 635. # … with 1,694 more rows ``` ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% * filter(year == 2002) ``` ] .right-panel-geom_discrete_continuous_build-auto[ ``` # A tibble: 142 x 6 country continent year lifeExp pop gdpPercap <fct> <fct> <int> <dbl> <int> <dbl> 1 Afghanistan Asia 2002 42.1 25268405 727. 2 Albania Europe 2002 75.7 3508512 4604. 3 Algeria Africa 2002 71.0 31287142 5288. 4 Angola Africa 2002 41.0 10866106 2773. 5 Argentina Americas 2002 74.3 38331121 8798. 6 Australia Oceania 2002 80.4 19546792 30688. 7 Austria Europe 2002 79.0 8148312 32418. 8 Bahrain Asia 2002 74.8 656397 23404. 9 Bangladesh Asia 2002 62.0 135656790 1136. 10 Belgium Europe 2002 78.3 10311970 30486. # … with 132 more rows ``` ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% * mutate(higher_income = gdpPercap > 20000) ``` ] .right-panel-geom_discrete_continuous_build-auto[ ``` # A tibble: 142 x 7 country continent year lifeExp pop gdpPercap higher_income <fct> <fct> <int> <dbl> <int> <dbl> <lgl> 1 Afghanistan Asia 2002 42.1 25268405 727. FALSE 2 Albania Europe 2002 75.7 3508512 4604. FALSE 3 Algeria Africa 2002 71.0 31287142 5288. FALSE 4 Angola Africa 2002 41.0 10866106 2773. FALSE 5 Argentina Americas 2002 74.3 38331121 8798. FALSE 6 Australia Oceania 2002 80.4 19546792 30688. TRUE 7 Austria Europe 2002 79.0 8148312 32418. TRUE 8 Bahrain Asia 2002 74.8 656397 23404. TRUE 9 Bangladesh Asia 2002 62.0 135656790 1136. FALSE 10 Belgium Europe 2002 78.3 10311970 30486. TRUE # … with 132 more rows ``` ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% * ggplot() ``` ] .right-panel-geom_discrete_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_build_auto_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + * aes(y = fct_rev(continent)) ``` ] .right-panel-geom_discrete_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_build_auto_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + * aes(x = lifeExp) ``` ] .right-panel-geom_discrete_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_build_auto_6_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_build-auto[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + * geom_point() ``` ] .right-panel-geom_discrete_continuous_build-auto[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_build_auto_7_output-1.png" width="100%" /> ] <style> .left-panel-geom_discrete_continuous_build-auto { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-geom_discrete_continuous_build-auto { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-geom_discrete_continuous_build-auto { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + geom_boxplot(alpha = .1) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_1_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * geom_boxplot(width = .1, outlier.shape = NA, alpha = 0.5) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_2_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * geom_jitter(width = .2, alpha = .5, color = "green") + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * geom_violin(alpha = .1) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggforce::geom_sina(col = "magenta", alpha = .5) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * stat_summary(fun.y = mean, geom = "point", col = "goldenrod2", size = 8) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_6_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(alpha = .2, fill = "blue") + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_7_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(scale = .7, alpha = .2, fill = "blue") + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_8_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(scale = 1.5, alpha = .2, fill = "blue") + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_9_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges_gradient(aes(fill = stat(x))) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_10_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::stat_density_ridges(quantile_lines = TRUE, quantiles = c(0.025, 0.975), alpha = 0.5, fill = "plum4") + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_11_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(jittered_points = TRUE, position = "raincloud", alpha = .5, scale = 0.9) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_12_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(stat = "binline", bins = 20, scale = 0.95, draw_baseline = FALSE) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_13_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::geom_density_ridges(scale = 2, alpha = .5) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_14_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * ggridges::scale_fill_cyclical(values = c("blue", "green")) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_15_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * geom_point(aes(color = continent), position = position_nudge(x = 0, y = .2), size = .5, alpha = 0.8) + geom_boxplot(width = .1, outlier.shape = NA, alpha = 0.5) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_16_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous-rotate[ ```r gapminder %>% filter(year == 2002) %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(y = fct_rev(continent)) + aes(x = lifeExp) + geom_point() + * geom_histogram(aes(y = after_stat(density))) + theme_minimal() + labs(y = NULL) ``` ] .right-panel-geom_discrete_continuous-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_rotate_17_output-1.png" width="100%" /> ] <style> .left-panel-geom_discrete_continuous-rotate { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-geom_discrete_continuous-rotate { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-geom_discrete_continuous-rotate { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + ggbeeswarm::geom_quasirandom(aes(x = continent, y = lifeExp)) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_1_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggbeeswarm::geom_quasirandom(aes(color = continent)) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_2_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggbeeswarm::geom_quasirandom(aes(color = higher_income), dodge.width = .8) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_3_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggpol::geom_boxjitter(alpha = 0.3) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_4_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggpol::geom_boxjitter(aes(color = continent), alpha = 0.3) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_5_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggpol::geom_boxjitter(aes(color = higher_income), alpha = 0.3) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_6_output-1.png" width="100%" /> ] --- class: split-40 count: false .left-panel-geom_discrete_continuous_bee-rotate[ ```r gapminder %>% mutate(higher_income = gdpPercap > 20000) %>% ggplot() + aes(x = continent) + aes(y = lifeExp) + aes(alpha = year) + theme_minimal() + * ggpol::geom_boxjitter(jitter.colour = "steelblue2", errorbar.draw = TRUE) ``` ] .right-panel-geom_discrete_continuous_bee-rotate[ <img src="geoms_continuous_distribution_files/figure-html/geom_discrete_continuous_bee_rotate_7_output-1.png" width="100%" /> ] <style> .left-panel-geom_discrete_continuous_bee-rotate { color: #777; width: 59%; height: 92%; float: left; font-size: 80% } .right-panel-geom_discrete_continuous_bee-rotate { width: 40%; float: right; padding-left: 1%; font-size: 80% } .middle-panel-geom_discrete_continuous_bee-rotate { width: NA%; float: left; padding-left: 1%; font-size: 80% } </style> <style type="text/css"> .remark-code{line-height: 1.5; font-size: 55%} </style>