dat
# A tibble: 230 x 13 manufacturer model displ year cyl trans drv cty hwy fl <chr> <chr> <dbl> <int> <int> <chr> <chr> <int> <int> <chr> 1 audi a4 1.8 1999 4 auto~ f 18 29 p 2 audi a4 1.8 1999 4 manu~ f 21 29 p 3 audi a4 2 2008 4 manu~ f 20 31 p 4 audi a4 2 2008 4 auto~ f 21 30 p 5 audi a4 2.8 1999 6 auto~ f 16 26 p 6 audi a4 2.8 1999 6 manu~ f 18 26 p 7 audi a4 3.1 2008 6 auto~ f 18 27 p 8 audi a4 q~ 1.8 1999 4 manu~ 4 18 26 p 9 audi a4 q~ 1.8 1999 4 auto~ 4 16 25 p 10 audi a4 q~ 2 2008 4 manu~ 4 20 28 p # ... with 220 more rows, and 3 more variables: class <chr>,# cyl_text <glue>, cyl_color <chr>
dat %>% ggplot()
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2)
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity()
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text)
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption )
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal()
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none')
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank())
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines"))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot')
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3')) + theme(axis.text = element_text(size = 12))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3')) + theme(axis.text = element_text(size = 12)) + theme(axis.title = element_text(size = 12, face = 'bold', color = '#525252'))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3')) + theme(axis.text = element_text(size = 12)) + theme(axis.title = element_text(size = 12, face = 'bold', color = '#525252')) + theme(axis.title.x = element_text(margin = unit(c(.5, 0, 0, 0), "cm")))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3')) + theme(axis.text = element_text(size = 12)) + theme(axis.title = element_text(size = 12, face = 'bold', color = '#525252')) + theme(axis.title.x = element_text(margin = unit(c(.5, 0, 0, 0), "cm"))) + theme(axis.title.y = element_text(angle = 0, vjust = 1))
dat %>% ggplot() + geom_point(aes(x = cty, y = hwy, color = cyl_color), alpha = 0.7, size = 2) + scale_color_identity() + facet_wrap(~ cyl_text) + labs( title = title, subtitle = subtitle, x = 'City MPG', y = 'Highway\nMPG', caption = caption ) + theme_minimal() + theme(legend.position = 'none') + theme(text = element_text(family = 'Fira Code')) + theme(panel.grid = element_blank()) + theme(panel.spacing = unit(1, "lines")) + theme(plot.background = element_rect(fill = '#D3D3D3')) + theme(plot.margin = unit(c(.5,.75,.5,.75), 'cm')) + theme(plot.title.position = 'plot') + theme(plot.title = element_markdown(size = 16, face = 'bold', color = '#525252', lineheight = 1.2)) + theme(plot.subtitle = element_textbox_simple( size = 10, lineheight = 1.2, padding = margin(5.5, 5.5, 5.5, 5.5), margin = margin(0, 0, 5.5, 0), fill = '#CCCCCC')) + theme(plot.caption = element_textbox_simple( size = 9, lineheight = 1.2, margin = margin(20, 50, 0, 0), fill = '#D3D3D3')) + theme(axis.text = element_text(size = 12)) + theme(axis.title = element_text(size = 12, face = 'bold', color = '#525252')) + theme(axis.title.x = element_text(margin = unit(c(.5, 0, 0, 0), "cm"))) + theme(axis.title.y = element_text(angle = 0, vjust = 1)) + theme(strip.text = element_markdown(size = 14))
`{.r .distill-force-highlighting-css}
<style type="text/css">.remark-code{line-height: 1.5; font-size: 120%}@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>```{.r .distill-force-highlighting-css}
dat %>% ggplot()
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |