class: center, middle, inverse, title-slide # Ex. 2.1: Building Your Plot ## Histogram --- count: false .panel1-the_chunk-auto[ ```r *employed_under_150K ``` ] .panel2-the_chunk-auto[ ``` # A tibble: 80,635 x 5 Earnings Earnings_per_member Sex Age Education <dbl> <dbl> <chr> <dbl> <chr> 1 8000 1600 F 20 Less than HS 2 4000 800 M 16 Less than HS 3 17350 8675 M 27 Less than HS 4 12000 6000 M 24 Less than HS 5 25480 25480 M 62 Bachelors 6 6000 1000 F 53 Bachelors 7 70200 11700 M 52 Bachelors 8 10520 1753. F 16 Less than HS 9 46000 11500 F 31 Some College/Associates 10 40000 40000 M 37 Less than HS # … with 80,625 more rows ``` ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% * ggplot() ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_02_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + * aes(x = Earnings) ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_03_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + * geom_histogram(position = "dodge") ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_04_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + geom_histogram(position = "dodge") + * aes(fill = Sex) ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_05_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + geom_histogram(position = "dodge") + aes(fill = Sex) + * labs(x = "Earnings (USD)") ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_06_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + geom_histogram(position = "dodge") + aes(fill = Sex) + labs(x = "Earnings (USD)") + * labs(y = "Count") ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_07_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + geom_histogram(position = "dodge") + aes(fill = Sex) + labs(x = "Earnings (USD)") + labs(y = "Count") + * labs(title = "Histogram of Earnings by Sex") ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_08_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Earnings) + geom_histogram(position = "dodge") + aes(fill = Sex) + labs(x = "Earnings (USD)") + labs(y = "Count") + labs(title = "Histogram of Earnings by Sex") + * facet_wrap(facets = vars(Sex)) ``` ] .panel2-the_chunk-auto[ <img src="ex2.1_embed_files/figure-html/the_chunk_auto_09_output-1.png" width="576" /> ] <style> .panel1-the_chunk-auto { color: black; width: 49%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-the_chunk-auto { color: black; width: 49%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-the_chunk-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> <style type="text/css"> .remark-code{line-height: 1.5; font-size: 90%} @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>